BUTTONS ON A WINDOW

BUTTONS ON A WINDOW

Postby Silvio » Fri Aug 04, 2006 11:18 pm

I must create in a window 160 buttons

I create this function to create buttons :

Code: Select all  Expand view
STATIC FUNCTION  makebuttons(X,y,oCassa,oFont,oGet,oLBX)
   LOCAL k
BOTTONI :=40
                 n  := 1
                 aBtn := Array(BOTTONI)
                 X = 20
                 Y = 810

USE LISTBAR Alias LISTBAR
                 INDEX ON LISTBAR->PUSH TO LISTBAR

                 FOR k := 1 TO BOTTONI
                    cCaption := ""

                       nBottone:=n
                      LISTBAR->(DbSeek(nBottone))
                      cCaption := AllTrim(LISTBAR->CODICE)

                       IF !Empty( cCaption )

              @ X+2  ,Y BUTTON aBtn[n] PROMPT cCaption OF oCassa FONT oFont ;
              SIZE 140,85 PIXEL
           ELSE
                 @ X+2  ,Y BUTTON aBtn[n] PROMPT Str(nBottone,3,0) OF oCassa FONT oFont ;
              SIZE 140,85 PIXEL

                 ENDI

                     * SayNum(oGet,5)
                              aBtn[n]:bAction := {|oBtn| AddLbx(oGet,oBtn,oLbx) }

                              // SE C'è L'ARTICOLO SI OPPURE NO CHIARO?????
                              IF !Empty(cCaption )
                                   aBtn[n]:cargo := { 'Full', n }
                                ELSE
                                   aBtn[n]:cargo := { 'Empty', n }
                                ENDIF


                   X +=85
                    n++
                    LISTBAR->(dbskip())
                    IF n= 11  .OR. n=21 .OR. n=31
                        X=20
                       Y=Y+145
                       ENDIF

                    NEXT


   y=810
                @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA1  OF oCassa FONT oFont ;
              SIZE 140,50 PIXEL
                Y=Y+145

                 @ X+2  ,Y BUTTON aPag2 PROMPT PAGINA2  OF oCassa FONT oFont ;
              SIZE 140,50 PIXEL
                 Y=Y+145
                @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA3  OF oCassa FONT oFont ;
              SIZE 140,50 PIXEL
                     Y=Y+145
                 @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA4  OF oCassa FONT oFont ;
              SIZE 140,50 PIXEL
RETURN NIL




Now I create only 40 buttons because I want insert on bottom another buttons
Page1,Page2,Page3 and Page4

when I clicked on pag2 the procedure must me show the interval from button number 41 to button number 80

How I can Make it ?

Regards[/b]
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Sat Aug 05, 2006 9:55 am

Silvio,

Please provide a small and self contained sample. A PRG that can be compiled and tested quickly. Its the only way to provide efficient tech support. Thanks,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Sat Aug 05, 2006 7:17 pm

ok :
this isthe link
http://hyperupload.com/download/02ed1fb ... s.zip.html

I made this sample to see only 40 buttons but I want to show 160 button at the same positions :
I explain you

Page 1 ->>> from 1 to 40 button
Page2 ->>>> from 41 to 80 button
Page3 ->>>>>from 81 to 120 button
Page4 ->>>>>>from 121 to 160 button

thank in advance...
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Sat Aug 05, 2006 9:38 pm

Silvio,

What screen resolution do you use ? We can't see the full window...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Sun Aug 06, 2006 3:18 pm

oopss 1400x1050 now
but I modified the test with screen 1280X1024

the code is :
Code: Select all  Expand view
#include "fivewin.ch"

#define PAGINA1     "Pag1"
#define PAGINA2     "Pag2"
#define PAGINA3     "Pag3"
#define PAGINA4     "Pag4"


  // TO Antonio
// I made this sample WITH 40 buttons but I want TO see 160 buttons !!!!!!!!!!!!!







Function cassa()
LOCAL  oWnd,oFont,oFont2,oFont3

DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, -20
  DEFINE FONT oFont2 NAME "MS Sans Serif" SIZE 0, -40
  DEFINE FONT oFont3 NAME "ARIAL" SIZE 0, -50


DEFINE WINDOW oWnd STYLE nOr( WS_POPUP, WS_VISIBLE ) COLOR GetSysColor(13), GetSysColor(1)

@20,5 LISTBOX oLbx FIELDS "";
                         HEADER "ARTICOLO",  "QTA",  ;
                                "PREZZO", "TOTALE"                     ;
                         OF oWnd SIZE 650,600 PIXEL                     ;
                         SIZES  230, 80,90,90;
                         FONT oFont




  makebuttons(20,660,oWnd,oFont,oLBX)


ACTIVATE WINDOW oWnd MAXIMIZED
RETURN NIL





STATIC FUNCTION  makebuttons(X,y,ownd,oFont,oLBX)
   LOCAL k


   BOTTONI :=40     // but I want see 160 buttons !!!!!!!!!!!!!



                 n  := 1
                 aBtn := Array(BOTTONI)
                 X = 20
                 Y = 660

                USE LISTBAR Alias LISTBAR
                INDEX ON LISTBAR->PUSH TO LISTBAR

                 FOR k := 1 TO BOTTONI
                    cCaption := ""

                       nBottone:=n
                      LISTBAR->(DbSeek(nBottone))
                      cCaption := AllTrim(LISTBAR->CODICE)

                       IF !Empty( cCaption )

              @ X+2  ,Y BUTTON aBtn[n] PROMPT cCaption OF oWnd FONT oFont ;
              SIZE 140,85 PIXEL
           ELSE
                 @ X+2  ,Y BUTTON aBtn[n] PROMPT Str(nBottone,3,0) OF oWnd FONT oFont ;
              SIZE 140,85 PIXEL

                 ENDI

                     /*
                              aBtn[n]:bAction := {|oBtn| AddLbx(oGet,oBtn,oLbx) }


                              IF !Empty(cCaption )
                                   aBtn[n]:cargo := { 'Full', n }
                                ELSE
                                   aBtn[n]:cargo := { 'Empty', n }
                                ENDIF

*/









                   X +=85
                    n++
                    // LISTBAR->(dbskip())
                    IF n= 11  .OR. n=21 .OR. n=31
                        X=20
                       Y=Y+145
                       ENDIF

                    NEXT



                    // bottoni per le pagine ???????
                    // ma come cambiare pagina ??????
                    // Pagina1  da 1a 40
                    // pagina 2 da 41 a 80
                    // pagina 3 da 81 a 120
                    // pagina 4 da 121 a 160


                    y=660
                @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA1  OF oWnd FONT oFont ;
              SIZE 140,50 PIXEL
                Y=Y+145

                 @ X+2  ,Y BUTTON aPag2 PROMPT PAGINA2  OF oWnd FONT oFont ;
              SIZE 140,50 PIXEL
                 Y=Y+145
                @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA3  OF oWnd FONT oFont ;
              SIZE 140,50 PIXEL
                     Y=Y+145
                 @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA4  OF oWnd FONT oFont ;
              SIZE 140,50 PIXEL

                CLOSE LISTBAR
                Select 1




                // PULSANTE FINE
                @ 980 ,1100 BUTTON aSTOR PROMPT "USCITA" OF oWnd FONT oFont ;
              SIZE 140,50 PIXEL  ACTION oWnd:END()



      RETURN NIL
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Sun Aug 06, 2006 4:53 pm

Silvio,

Just a sample:
Code: Select all  Expand view
                 @ X+2  ,Y BUTTON aPag2 PROMPT PAGINA2  OF oWnd FONT oFont ;
              SIZE 140,50 PIXEL ACTION Pagina2( oWnd )
...
      function Pagina2( oWnd )
     
         local n
         
         for n = 2 to 41
            oWnd:aControls[ n ]:SetText( AllTrim( Str( n + 39 ) ) )
         next
         
      return nil     

From Pagina2() you may use your DBF to find the right text, and also change DATA bAction of buttons.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Sun Aug 06, 2006 9:06 pm

THANKS ANTONIO

BUT i HAVE ON ORIGINAL WINDOW MANY CONTROL
HOW i CAN MAKE TO KNOW THE NUMBER OF CONTROLS TO CHANGE ?
THERE IS A FUNCTION TO GIVE ME A LIST OF ALL CONTROLS OD THE WINDOWS WITH THEIR NUMBERS ?

REGARDS
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Sun Aug 06, 2006 9:33 pm

Silvio,

You may use their DATA cargo to store an identifier, or check its position in oWnd:aControls, its nID, etc.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Silvio » Mon Aug 07, 2006 2:19 pm

thank i resolve it
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Silvio » Mon Aug 07, 2006 4:05 pm

Dear Antonio,

Now I use STYLE nOr( WS_POPUP, WS_VISIBLE ) to show the window but i wanted create a window (child of mainwindow)
when I shrink the window or increase the window the procedure must repaint all the controls (lbx and buttons) :

there is a sample as it ?
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Mon Aug 07, 2006 8:57 pm

Silvio,

Windows may do it automatically. In case you want to force it you may do a oWnd:Refresh()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 140 guests