To resize controls on the window

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

To resize controls on the window

Post by Silvio »

How I can resize control on the window ?


I try this but if I try the program make the same :
when I resize the window it hide
the controls

Code: Select all


function Main() 

   local oBar 

   DEFINE WINDOW oWnd MDI ; 
      TITLE "Browsing a DataBase" 

   DEFINE BUTTONBAR oBar 3D OF oWnd 

   DEFINE BUTTON OF oBar ACTION CustomerBrowse() 

   SET MESSAGE OF oWnd TO "FiveWin xBase power!" CENTERED 

   ACTIVATE WINDOW oWnd MAXIMIZED 

   return nil 
FUNCTION CustomerBrowse() 
LOCAL  oWndChild,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 oWndChild  COLOR GetSysColor(13), GetSysColor(1) 
  *STYLE nOr( WS_POPUP, WS_VISIBLE ) COLOR GetSysColor(13), GetSysColor(1) 


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




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


  ACTIVATE WINDOW oWndChild MAXIMIZED; 
  ON RESIZE RESIZE_WINDOW(oWndChild) 
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 BAR 


                 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 

                 ENDIF 

                     /* 
                              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  .OR. n=41 
                        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 

                     X=900 
                    y=660 
                @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA1  OF oWnd FONT oFont ; 
              SIZE 140,50 PIXEL 
              *ACTION Pagina1( oWnd ) 
                Y=Y+145 

                 @ X+2  ,Y BUTTON aPag2 PROMPT PAGINA2  OF oWnd FONT oFont ; 
              SIZE 140,50 PIXEL 
              *ACTION Pagina2( oWnd ) 
                 Y=Y+145 
                @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA3  OF oWnd FONT oFont ; 
              SIZE 140,50 PIXEL 
              *ACTION Pagina3( oWnd ) 
                     Y=Y+145 
                 @ X+2  ,Y BUTTON aPag1 PROMPT PAGINA4  OF oWnd FONT oFont ; 
              SIZE 140,50 PIXEL 
              *ACTION SUBTOTALE(oWnd) 

               * CLOSE LISTBAR 
               * Select 1 




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

                  * oWnd:SetControl( aBtn ) 

                RETURN NIL 

           function Pagina1( oWnd ) 

         local n 

         for n = 2 to 41 
            oWnd:aControls[ n ]:SetText( AllTrim( Str( n -1) ) ) 
         next 

      return nil 





   FUNCTION RESIZE_WINDOW(oWndChild) 

      // on resize 
    for n = 1 to 41 

 oWndChild:aControls[ n ]:nTop = (oWndChild:aControls[ n ]:nTop )-2 
 oWndChild:aControls[ n ]:nLeft = ( oWndChild:aControls[ n ]:nLeft)-2 
 oWndChild:aControls[ n ]:nWidth = ( oWndChild:aControls[ n ]:nWidth)-1 
 oWndChild:aControls[ n ]:nHeight = (oWndChild:aControls[ n ]:nHeight)-1 

      next 
     * oWndChild:refresh() 
        RETURN nil
Please help me !!!!!!!!!!!!!!!!!!!!!!!!!! :(
Best Regards, Saludos

Falconi Silvio
Post Reply