Author
Topic: Resize/Move Example (Read 1081 times)

I have posted this before but over time I tweak things to make it better so wanted to post a last version as you look at closing things down there. Please replace what I submitted before with the following please. Assuming you think someone might find it useful. I use these resizing routines extensively and have yet to find a situation where they can't be implemented to great effect.

;################################################################################################; GIVE each Dialog a UNIQUE 'win_track' value and be sure to reset when you return from a sub-dialog.;Get_Control_Movement() gets the initial size of the dialog and builds the array of the grow/move definitions;you have defined.;################################################################################################

;################################################################################################;The following restores the Dialog to the same size and position as when last closed.;################################################################################################

;################################################################################################;################################################################################################; ;; Below are the Routines you can use with any dialog. ;; The only change is the GROW/MOVE definitions which ;; are enclosed in IF statements based on the win_track ;; value. ;; ***************** ;; ;; You may need to tweak some of the code due to the fact ;; that I have a standard way of naming my control names. ;; Each Control type has a specific prefix. If you use WB_RAD ;; to produce your Callback code as a starting point then you ;; will need to change nothing. I think there is only one place ;; and it at the end of the last function and it is marked. Apologies ; ; if I missed any others. ;; ;;################################################################################################;################################################################################################

;Dialog Resize/Move example. Not sure on WinBatch version required. I do make use of the new dialog CONSTANTS. If you define those then you can;probably drop back to 2010C. It uses the 6.2 version of dialogs.;You can set a limit of how small you want to shrink/move controls within the Dialog itself. This must be set or this code will generate an error.;Jim Taylor (jtaylor@jtdata.com)

#DefineSubRoutine Get_Control_Movement(Mov_Handle, win_track)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;The following is the initial sizes, enumeration and settings ;for how a control will be handled during a resize. Obviously, ;it would be nice if this information was contained, and handled, ;by the Dialog. You can GROW and MOVE the same control. You ;must define what percentage of the change the control will receive, ;both vertically and horizontally.

;If you have stacked controls then keep in mind that the ;percentage of the move/grow changes as you move down/across. ;That is, if you have four controls, the first one might stay ;where it is (no move) but have .25 for the grow, ;the second will receive .25 for the move and .25 for the grow, ;the third will have .5 for the move and .25 for the grow;the fourth will have .75 for the move and .25 for the grow.

;If you have very many controls you may find this easier to maintain;in an external file and use ArrayFileGetCSV(). The following format;will work. The header row is important as it fills the first row;thereby allowing one to use a one-based array.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;This is the move/grow definition for each control. Yes, at times it can get a bit tedious.;Do note that the last line will NOT have a @CR on the end.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; arr_txt ="" arr_txt = arr_txt:"name, movement, x_m, x_g, y_m, y_g":@CR

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Moving the dialog on the screen will often result in the size changing by one unit so ;I account for that here and do not resize if the change is only one unit. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;