Hi all,
I have a main dialog. This is resizable and the controls on the dialog
are also resized, that is, their size and/or their location.
I do this by deleting the controls when resizing and creating them again.
I first used relocating them and resizing them but this left garbage on my
dialog window. Killing and recreating the controls does the job but I have
another problem now:
From this dialog, I open a second dialog by pressing
a button. When closing the second window something strange happens: when
When resizing the main window, the font of the buttons on the main window changes.
When I resize the main window without first opening the second window, nothing
abnormal happens.. I have stripped down my code to the minimum, still showing
the problem. Anybody have any idea?
Kind regards
Eddy
------------------
[email protected]
I have a main dialog. This is resizable and the controls on the dialog
are also resized, that is, their size and/or their location.
I do this by deleting the controls when resizing and creating them again.
I first used relocating them and resizing them but this left garbage on my
dialog window. Killing and recreating the controls does the job but I have
another problem now:
From this dialog, I open a second dialog by pressing
a button. When closing the second window something strange happens: when
When resizing the main window, the font of the buttons on the main window changes.
When I resize the main window without first opening the second window, nothing
abnormal happens.. I have stripped down my code to the minimum, still showing
the problem. Anybody have any idea?
Kind regards
Eddy
Code:
#COMPILE EXE #REGISTER NONE #DIM ALL #INCLUDE "win32api.inc" #INCLUDE "commctrl.inc" GLOBAL hMain& ' Dialog handle GLOBAL hST& GLOBAL MinDialogHeight AS LONG GLOBAL MinDialogWidth AS LONG %EXITBUTTON = 102 %SETTINGSBUTTON = 106 %ST_DONEBUTTON = 218 DECLARE FUNCTION PBMAIN_Settings AS LONG DECLARE SUB ShowDialog_Main(BYVAL hParent&) DECLARE CALLBACK FUNCTION DLGPROC_Main DECLARE SUB ShowDialog_ST(BYVAL hParent&) DECLARE CALLBACK FUNCTION DLGPROC_ST ' Main DECLARE CALLBACK FUNCTION CBF_EXITBUTTON() DECLARE CALLBACK FUNCTION CBF_SETTINGSBUTTON() ' Settings DECLARE CALLBACK FUNCTION CBF_ST_DONEBUTTON() FUNCTION PBMAIN MinDialogHeight = 100 MinDialogWidth = 224 ShowDialog_Main 0 END FUNCTION FUNCTION PBMAIN_Settings AS LONG ShowDialog_ST 0 END FUNCTION SUB ShowDialog_Main(BYVAL hParent&) DIALOG NEW hParent&, "Click 'Settings', click 'Done', then resize window.. and watch button font change..:-(", 0, 0, 390, 60, %WS_OVERLAPPEDWINDOW OR %DS_CENTER, 0 TO hMain& CONTROL ADD "Button", hMain&, %EXITBUTTON, "Exit", 3, 160, 40, 15, _ %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CONTROL ADD "Button", hMain&, %SETTINGSBUTTON, "Settings", 3, 143, 40, 15, _ %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP DIALOG SHOW MODAL hMain& , CALL DLGPROC_Main END SUB SUB ResizeMainDialog DIM x AS LONG, y AS LONG DIALOG GET SIZE hMain TO x, y IF y < MinDialogHeight THEN y = MinDialogHeight IF x < MinDialogWidth THEN x = MinDialogWidth DIALOG SET SIZE hMain&, x, y DIALOG GET CLIENT hMain TO x, y CONTROL KILL hMain&, %EXITBUTTON CONTROL ADD "Button", hMain&, %EXITBUTTON, "Exit", 3, y-17, 40, 15, _ %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CALL CBF_EXITBUTTON CONTROL KILL hMain&, %SETTINGSBUTTON CONTROL ADD "Button", hMain&, %SETTINGSBUTTON, "Settings", 3, y-34, 40, 15, _ %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CALL CBF_SETTINGSBUTTON END SUB SUB ShowDialog_ST(BYVAL hParent&) DIALOG NEW hParent&, "Settings", 0, 0, 219, 167, 0, 0 TO hST& CONTROL ADD "Button", hST&, %ST_DONEBUTTON, "Done", 80, 149, 53, 15, _ %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CALL CBF_ST_DONEBUTTON DIALOG SHOW MODAL hST& , CALL DLGPROC_ST END SUB CALLBACK FUNCTION DLGPROC_Main SELECT CASE CBMSG CASE %WM_SIZE ResizeMainDialog END SELECT END FUNCTION CALLBACK FUNCTION DLGPROC_ST END FUNCTION CALLBACK FUNCTION CBF_EXITBUTTON IF CBCTLMSG=%BN_CLICKED THEN DIALOG END hMain END FUNCTION CALLBACK FUNCTION CBF_SETTINGSBUTTON IF CBCTLMSG=%BN_CLICKED THEN PBMAIN_Settings END FUNCTION CALLBACK FUNCTION CBF_ST_DONEBUTTON IF CBCTLMSG=%BN_CLICKED THEN DIALOG END hST END FUNCTION
------------------
[email protected]
Comment