WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialog Editor
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Save and Restore a WIL Dialogs Size and Location

 Keywords: Save Restore INI WIL Dialog Size Location X Y

;; Ini file with dialog position info.
strLocIni = DirScript():"LocateMe.ini"

;;; Save current dialog location to ini file.
#DefineFunction PlacementSave(strCaption, strLocIni)
   strRect = WinPlaceGet(@NORMAL, strCaption)
   IniWritePvt("Position", "rect",  strRect, strLocIni)
   Return 1
#EndFunction

;;; Position dialog based on saved position in ini file.
#DefineFunction PlacementRestore(strCaption, strLocIni)
   strRect = IniReadPvt("Position", "rect",  "-1", strLocIni)
   If strRect != "-1" Then WinPlaceSet(@NORMAL, strCaption, strRect)
   Then Return 1
   Else Return 0
#EndFunction

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Rough example of UDF that can both save
;; and restore a dialogs location .
#DefineSubRoutine LocateCallback(LocateMe_Handle,LocateMe_Message,LocateMe_Name,LocateMe_EventInfo,LocateMe_ChangeInfo)
   Switch LocateMe_Message
      Case 0   ;; Initialize.
         PlacementRestore(LocateMeCaption, strLocIni)
         DialogProcOptions(LocateMe_Handle,2,@TRUE)  ; Button clicks.
         ;;DialogProcOptions(LocateMe_Handle,11,@TRUE) ; System menu Close.
         Break
      Case 2   ;; Button pressed
      ;;case 11  ;; System menu close. (Uncomment for close system menu.)
            PlacementSave(LocateMeCaption, strLocIni)
          Break
   EndSwitch
   Return(-1)
#EndSubRoutine

LocateMeFormat=`WWWDLGED,6.2`

LocateMeCaption=`Locate Me`
LocateMeX=-1
LocateMeY=-1
LocateMeWidth=326
LocateMeHeight=245
LocateMeNumControls=002
LocateMeProcedure=`LocateCallback`
LocateMeFont=`DEFAULT`
LocateMeTextColor=`DEFAULT`
LocateMeBackground=`DEFAULT,DEFAULT`
LocateMeConfig=0

LocateMe001=`079,230,033,010,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT`
LocateMe002=`201,230,033,010,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("LocateMe")

Article ID:   W17699
Filename:   Save and Restore a WIL Dialogs Size and Location.txt
File Created: 2014:02:25:08:38:14
Last Updated: 2014:02:25:08:38:14