OK
i WANTED TO RESIZE ALL CONTROLS ON THE WND
i MADE A WINDOW MAXIMIZED BUT i WANTED THE USER CAN RESIZE THE WINDOW TO A SMALL WINDOW SEEING ALL THE CONTROLS AND OPERATING INTO
i TRY YOUR SAMPLE WITH MY MODIFIES
- Code: Select all Expand view
# include "Fivewin.ch"
#define PAGINA1 "Pag1"
#define PAGINA2 "Pag2"
#define PAGINA3 "Pag3"
#define PAGINA4 "Pag4"
FUNCTION MAIN()
LOCAL oWnd ,oLbx ,oFont
LOCAL cVar := SPACE( 35 )
DEFINE WINDOW oWnd
DEFINE FONT oFont NAME "MS Sans Serif" SIZE 0, -20
@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;
ON RESIZE RESIZECONTROLS(nSizeType,nWidth,nHeight,oWnd );
RETURN NIL
STATIC FUNCTION RESIZECONTROLS(nSizeType,nWidth,nHeight, oWnd )
LOCAL oCtl
LOCAL i
STATIC aWidth := {}
STATIC aHeight := {}
STATIC StartWidth , StartHeight
IF EMPTY( aWidth )
FOR EACH oCtl IN oWnd:aControls
AADD( aWidth , oCtl:nWidth() )
AADD( aHeight , oCtl:nHeight() )
NEXT
StartWidth := oWnd:nWidth()
StartHeight := oWnd:nHeight()
ENDIF
FOR EACH oCtl IN oWnd:aControls
i := Hb_EnumIndex()
oCtl:Move( oCtl:nTop, oCtl:nLeft, aWidth[i]* oWnd:nWidth()/StartWidth , aHeight[i] * oWnd:nHeight()/StartHeight , .T. )
NEXT
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
BUT NOT WORK GOOD !!
WHEN i RESIZE THE WINDOW i WANT SEE ALL THE CONTROLS !!!!
i THINK IT MUST CHANGE ALL THE COORDINATES X,Y OF EACH CONTROLS ?
CAN YOU HELP ME ?