Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
; ###################################################################################### ; ; *** Depending on where the 'Rolled Up' dialog is located will establish ; *** how the 'Rolled Down' dialog will expand. For example, if the rolled up ; *** dialog is deep in the lower right area of the screen, then the lower right ; *** corner of the dialog is the *anchor point*, and the rolled down dialog ; *** will appear to expand from that point. ; ; *** Getting the total dialog pixels for height comes up aprox. 10 units off, ; *** and no amount of fiddling with the likely culprit (Taskbar) seems to change it, ; *** so 10 units are subtracted from 'WinMetrics(-5)'. Maybe it's just me, so ; *** treat with a grain of salt. ; *** ; *** Keep the dialog's borders (both the rolled up and rolled down) within the ; *** viewable area. Pushing either one beyond the viewable area causes ; *** (by Winbatch default, I guess) to center the dialog on the next 'roll' pass. ; ; *** Take note that the dialogs incorporate substitution for the X and Y coordinates. ; *** You will need to first create the dialogs and then replace the numerical ; *** coordinates with the 'X_pos' and 'Y_pos' variables. : ; ###################################################################################### WinTitle("WBT", "Roller") ; *** Establish the number of dialog units for this system. ; *** Subtracted 10 units from vertical 'cause it came up that much ; *** over on the systems I tested on. Test and adjust if need be. unitsWide=Floor(Winmetrics(0)/WinMetrics(-6)) unitsHigh=Floor((Winmetrics(1)/WinMetrics(-5))-10) ; *** Set the initial dialog's coordinates for screen centering. X_pos="-1" Y_pos="-1" ; *** IMPORTANT *** ; *** Change these variables AFTER you have created both dialogs. ; *** They must match the dimensions of the smaller and larger dialogs. ; *** Then replace the dialogs actual coordinates with ; *** 'X_pos' and 'Y_pos' variables. small_dialog_wide = 100 ; <--- the 'Rolled Up' dialog width small_dialog_high = 020 ; <--- the 'Rolled Up' dialog height big_dialog_wide = 250 ; <--- the 'Rolled Down' dialog width big_dialog_high = 150 ; <--- the 'Rolled Down' dialog height :ROLLED_UP Flag="" ; *** Window floats IntControl(54,"Roller",1,0,0) ; *** Dialog is 'rolled up' (the smaller dialog). ; *** The width of the dialog is set to 100. ; *** The height of the dialog is set to 20. Rolled_UpFormat=`WWWDLGED,6.1` Rolled_UpCaption=`` Rolled_UpX=%X_pos% Rolled_UpY=%Y_pos% Rolled_UpWidth=100 Rolled_UpHeight=020 Rolled_UpNumControls=001 Rolled_UpProcedure=`DEFAULT` Rolled_UpFont=`DEFAULT` Rolled_UpTextColor=`DEFAULT` Rolled_UpBackground=`DEFAULT,DEFAULT` Rolled_UpConfig=0 Rolled_Up001=`001,001,094,014,PUSHBUTTON,DEFAULT,"Roll Down",1,1,128,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("Rolled_Up") ; *** Get this smaller dialog's X and Y coordinates X_pos=IntControl(75, 1, 0, 0, 0) Y_pos=IntControl(75, 2, 0, 0, 0) ;;; Message("", StrCat("X = ", X_pos, " ", "Y = ", Y_pos)) ;<--- for testing ; *** Now, if adding 250 units (the larger dialog's width) ; *** to the current X coordinate pushes the rolled down ; *** dialog past the right side of the display area AND ; *** if adding 150 units (the larger dialog's height) ; *** pushes it past the bottom of the display area, ; *** then appear to use the bottom right corner of the ; *** rolled up dialog as the anchor point. If ((X_pos + big_dialog_wide) > unitsWide) && ((Y_pos + big_dialog_high) > unitsHigh) X_pos = (X_pos - (big_dialog_wide - small_dialog_wide)) Y_pos = (Y_pos - (big_dialog_high - small_dialog_high)) Flag="setX-Y" goto ROLLED_DOWN EndIf ; *** We have enough space to expand down, but not enough ; *** to expand to the right, so appear to use the upper right ; *** corner as the anchor point. If ((X_pos + (big_dialog_wide)) > unitsWide) X_pos = (X_pos - (big_dialog_wide - small_dialog_wide)) Flag="setX" EndIf ; *** We have enough space to expand right, but not enough ; *** to expand down, so appear to use the lower left corner ; *** as the anchor point. If ((Y_pos + big_dialog_high) > unitsHigh) Y_pos = (Y_pos - (big_dialog_high - small_dialog_high)) Flag="setY" EndIf :ROLLED_DOWN ; *** Dialog is 'rolled down' (the larger dialog). ; *** The width of the dialog is set to 250 ; *** The height of the dialog is set to 150 Rolled_DownFormat=`WWWDLGED,6.1` Rolled_DownCaption=`` Rolled_DownX=%X_pos% Rolled_DownY=%Y_pos% Rolled_DownWidth=250 Rolled_DownHeight=150 Rolled_DownNumControls=002 Rolled_DownProcedure=`DEFAULT` Rolled_DownFont=`DEFAULT` Rolled_DownTextColor=`DEFAULT` Rolled_DownBackground=`DEFAULT,DEFAULT` Rolled_DownConfig=0 Rolled_Down001=`075,003,088,012,PUSHBUTTON,DEFAULT,"Roll Up",1,1,128,DEFAULT,DEFAULT,DEFAULT` Rolled_Down002=`103,029,036,012,PUSHBUTTON,DEFAULT,"Exit",3,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("Rolled_Down") ; *** Get this larger dialog's X and Y coordinates X_pos=IntControl(75, 1, 0, 0, 0) Y_pos=IntControl(75, 2, 0, 0, 0) If Flag=="setX-Y" X_pos=(X_pos + (big_dialog_wide - small_dialog_wide)) Y_pos=(Y_Pos + (big_dialog_high - small_dialog_high)) EndIf If Flag=="setX" then X_pos=(X_pos + (big_dialog_wide - small_dialog_wide)) If Flag=="setY" then Y_pos=(Y_Pos + (big_dialog_high - small_dialog_high)) If buttonpushed==1 then goto ROLLED_UP If buttonpushed==3 then exit
;You can make dialogs resize-able although I am not sure how useful it is. Here is simple example anyway ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Returns a window's styles ;;;;;;;;;;;;;;;;;;;;;;;;;;; #DefineFunction GetStyle(hWnd) user32 = StrCat(DirWindows(1),"user32.dll") GWL_STYLE = -16 ; offset for the Window Style value ret = DllCall(user32,long:"GetWindowLongA",long:hWnd,long:GWL_STYLE) Return ret #EndFunction ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Sets a window's styles ;;;;;;;;;;;;;;;;;;;;;;;;;;; #DefineFunction SetStyle(hWnd, nstyle) user32 = StrCat(DirWindows(1),"user32.dll") GWL_STYLE = -16 ; offset for the Window Style value ret = DllCall(user32,long:"SetWindowLongA",long:hWnd,long:GWL_STYLE,long:nstyle) Return ret #EndFunction ;;;;;;;;;;;;;;;;;;;;;;;;; ;; Dialog Callback ;;;;;;;;;;;;;;;;;;;;;;;;; #DefineFunction MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_ID,rsvd1,rsvd2) WS_THICKFRAME=262144 ; Style adds sizing border. MSG_INIT=0 ; The one-time initialization RET_DO_DEFAULT= -1 ; Continue with default processing for control Switch MyDialog_Message ; Switch based on Dialog Message type Case MSG_INIT ; Standard Initialization message ; Add System menus DialogProcOptions(MyDialog_Handle,1002, 4) ; Same as IntControl (49, 1, 0, 0, 0) ; Add a "sizable" boarder. nStyle = GetStyle(MyDialog_Handle) nStyle = nStyle | WS_THICKFRAME SetStyle(MyDialog_Handle,nStyle) Return(RET_DO_DEFAULT) EndSwitch ; MyDialog_Message Return(RET_DO_DEFAULT) #EndFunction ; End of Dialog Callback MyDialogCallbackProc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Dialog Template ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`A Resizable Dialog` MyDialogX=049 MyDialogY=054 MyDialogWidth=320 MyDialogHeight=197 MyDialogNumControls=002 MyDialogProcedure=`MyDialogCallbackProc` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`084,175,033,014,PUSHBUTTON,DEFAULT,"OK",1,DEFAULT,32,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`201,175,033,014,PUSHBUTTON,DEFAULT,"Cancel",0,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog")
Article ID: W16425
File Created: 2005:06:16:07:15:14
Last Updated: 2005:06:16:07:15:14