PDA

View Full Version : simple resize example



Lionheart008
01-08-2010, 17:32
hello, I only would like to know if this example for resize buttons/textbox (click for maximize window) is ok ?


' Empty GUI script created on 08-01-2010 17:11:04 by (ThinAIR)

Uses "UI"

'---Define a button ID
%ButtonClose = 1001
%ButtonClose2 = 1002
%ButtonClose3 = 1003
%ButtonClose4 = 1004
%ButtonClose5 = 1005
%ButtonClose6 = 1006
%textboxy = 1007

Dim hDlg As DWord

Dialog New 0, "myAPP",-1,-1, 450, 320, _
%WS_POPUP Or _
%WS_VISIBLE Or _
%WS_CLIPCHILDREN Or _
%WS_CAPTION Or _
%WS_SYSMENU Or _
%WS_MAXIMIZEBOX Or _
%WS_MINIMIZEBOX, _
0 To hDlg

Control Add Button, hDlg, %ButtonClose, "Click to kill", 190, 50, 80, 24
Control Add Button, hDlg, %ButtonClose2, "Click to kill2", 190, 75, 80, 24
Control Add Button, hDlg, %ButtonClose3, "Click to kill3", 270, 50, 80, 24
Control Add Button, hDlg, %ButtonClose4, "Click to kill4", 270, 75, 80, 24
Control Add Button, hDlg, %ButtonClose5, "Click to kill5", 350, 50, 80, 24
Control Add Button, hDlg, %ButtonClose6, "Click to kill6", 350, 75, 80, 24

Control Add Textbox, hDlg, %textboxy, "resize test" , 20, 20, 120, 240, _
%WS_TABSTOP Or _
%ES_WANTRETURN Or _
%ES_MULTILINE Or _
%ES_AUTOHSCROLL Or _
%ES_AUTOVSCROLL Or _
%WS_VSCROLL Or _
%WS_HSCROLL

Control Set Resize hDlg, %ButtonClose, 0,1,0,1
Control Set Resize hDlg, %ButtonClose2, 0,1,0,1
Control Set Resize hDlg, %ButtonClose3, 0,1,0,1
Control Set Resize hDlg, %ButtonClose4, 0,1,0,1
Control Set Resize hDlg, %ButtonClose5, 0,1,0,1
Control Set Resize hDlg, %ButtonClose6, 0,1,0,1

Control Set Resize hDlg, %textboxy, 1,1,0,1

Dialog Set Minsize hDlg, 340, 250

Dialog Show Modal hDlg Call cbDialog

'------------------------------------------------
' Callback function used to handle dialog events
'------------------------------------------------
CallBack Function cbDialog() As Long

Select Case CBMSG
Case %WM_COMMAND
If CBWPARAM = %ButtonClose Then Dialog End CBHNDL

Case %WM_DESTROY
MsgBox 0, "Window is to be destroyed."

End Select

End Function




best regards, frank

Petr Schreiber
01-08-2010, 18:30
Hi Frank,

I don't know what you mean exactly by "ok", but I would expect the resizing to be set up differently, this way:


Control Set Resize hDlg, %ButtonClose, 0,1,1,0
Control Set Resize hDlg, %ButtonClose2, 0,1,1,0
Control Set Resize hDlg, %ButtonClose3, 0,1,1,0
Control Set Resize hDlg, %ButtonClose4, 0,1,1,0
Control Set Resize hDlg, %ButtonClose5, 0,1,1,0
Control Set Resize hDlg, %ButtonClose6, 0,1,1,0

Control Set Resize hDlg, %textboxy, 1,1,1,1


The textbox area gets bigger on maximizing, and the buttons stay near the top.

The last 4 params Resize has have this meaning (as help file says):
Control Set Resize hWindow, idControl, LockLeftSide, LockRightSide, LockTopSide, LockBottomSide

You can imagine it like that putting "1" to one of the Lock* fields is similar to putting nail on that side of control.
When you take the dialog, and stretch it, the "nail" helps keeping that side on the same place relatively to specified direction.


Petr