WinBatch® Technical Support Forum

Archived Boards => WinBatch Dynamic Dialogs => Topic started by: JTaylor on January 16, 2017, 11:21:31 AM

Title: Resize/Move Example
Post by: JTaylor on January 16, 2017, 11:21:31 AM
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.

Thanks.

Jim


Code (winbatch) Select

WinHide("")

GoSub Function_Definitions

IntControl (49, 1, 1, 0, 0)

Home_Path     = DirScript()
DirChange(Home_Path)

;#include "resize_move.wdl"
;#include "resize.wbt"

profile       = "RESIZE"
System_Ini    = StrCat(Home_Path,"resize_move.ini")

op_win_size   = IniReadPvt(profile,"op_win_size","",System_Ini)
op_win_state  = IniReadPvt(profile,"op_win_state","",System_Ini)

;Dialog("OPROCESS")

OPROCESSFormat=`WWWDLGED,6.2`

OPROCESSCaption=`Order Processing`
OPROCESSX=-01
OPROCESSY=-01
OPROCESSWidth=510
OPROCESSHeight=348
OPROCESSMinWidth=510
OPROCESSMinHeight=348
OPROCESSNumControls=015
OPROCESSProcedure=`OP_Sub`
OPROCESSFont=`DEFAULT`
OPROCESSTextColor=`DEFAULT`
OPROCESSBackground=`DEFAULT,0|0|100`
OPROCESSConfig=2

OPROCESS001=`003,003,040,026,PUSHBUTTON,"pb_OPR_Complete_1",DEFAULT,"Complete",3,15,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|0",DEFAULT`
OPROCESS002=`047,003,064,024,VARYTEXT,"vt_OPR_station_1",station_1,"station",DEFAULT,18,DEFAULT,"Microsoft Sans Serif|17920|40|34","255|255|255",DEFAULT`
OPROCESS003=`113,003,030,024,VARYTEXT,"vt_OPR_ord_num_c_1",ord_num_c_1,"ord_num_c",DEFAULT,21,DEFAULT,"Microsoft Sans Serif|17920|40|34","255|255|255",DEFAULT`
OPROCESS004=`145,015,020,014,PUSHBUTTON,"pb_OPR_X1",DEFAULT,"X",24,24,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|0",DEFAULT`
OPROCESS005=`003,031,166,312,ITEMBOX,"ib_OPR_igrid_1",DEFAULT,DEFAULT,DEFAULT,27,@csNoAdjust,DEFAULT,DEFAULT,DEFAULT`
OPROCESS006=`171,003,040,026,PUSHBUTTON,"pb_OPR_Complete_2",DEFAULT,"Complete",6,30,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|0",DEFAULT`
OPROCESS007=`215,003,064,024,VARYTEXT,"vt_OPR_station_2",station_2,"station",DEFAULT,33,DEFAULT,"Microsoft Sans Serif|17920|40|34","255|255|255",DEFAULT`
OPROCESS008=`281,003,030,024,VARYTEXT,"vt_OPR_ord_num_c_2",ord_num_c_2,"ord_num_c",DEFAULT,36,DEFAULT,"Microsoft Sans Serif|17920|40|34","255|255|255",DEFAULT`
OPROCESS009=`313,015,020,014,PUSHBUTTON,"pb_OPR_X2",DEFAULT,"X",18,39,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|0",DEFAULT`
OPROCESS010=`171,031,166,312,ITEMBOX,"ib_OPR_igrid_2",DEFAULT,DEFAULT,DEFAULT,42,@csNoAdjust,DEFAULT,DEFAULT,DEFAULT`
OPROCESS011=`339,003,040,026,PUSHBUTTON,"pb_OPR_Complete_3",DEFAULT,"Complete",9,45,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|0",DEFAULT`
OPROCESS012=`383,003,064,024,VARYTEXT,"vt_OPR_station_3",station_3,"station",DEFAULT,48,DEFAULT,"Microsoft Sans Serif|17920|40|34","255|255|255",DEFAULT`
OPROCESS013=`449,003,030,024,VARYTEXT,"vt_OPR_ord_num_c_3",ord_num_c_3,"ord_num_c",DEFAULT,51,DEFAULT,"Microsoft Sans Serif|17920|40|34","255|255|255",DEFAULT`
OPROCESS014=`481,015,020,014,PUSHBUTTON,"pb_OPR_X3",DEFAULT,"X",21,54,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|0",DEFAULT`
OPROCESS015=`339,031,166,312,ITEMBOX,"ib_OPR_igrid_3",DEFAULT,DEFAULT,DEFAULT,57,@csNoAdjust,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("OPROCESS")



Exit

:FUNCTION_DEFINITIONS

#DefineSubRoutine OP_Sub(OPR_Handle,DMsg,DCID,DEInfo,ChangeInfo)

Switch (DMsg)
  Case @deInit
    DialogProcOptions(OPR_Handle, @deClose,1)                             ; Close selected (IntControl(49....) (1-On, 0-Off).
    DialogProcOptions(OPR_Handle, @deResize, 1)                           ; Resize Dialog.
    DialogProcOptions(OPR_Handle, @dePbPush,1)                            ; Pushbutton/PictureButton.
    DialogProcOptions(OPR_Handle, @deIbSelect,1)                          ; ItemBox.
    DialogProcOptions(OPR_Handle, @deIbDblclick,1)                        ; ItemBox Double-Clicked.       

    For icol = 1 to 3
      ord_num_c_%icol% = icol
      station_%icol% = "S-":icol

      igrid_%icol% = "Item Box %icol%"
      igrid_%icol%_list = "Item Box %icol%"

      DialogControlSet(OPR_Handle,"vt_OPR_station_%icol%",@dcTitle,station_%icol%)
      DialogControlSet(OPR_Handle,"vt_OPR_ord_num_c_%icol%",@dcTitle,ord_num_c_%icol%)
      DialogControlSet(OPR_Handle,"ib_OPR_igrid_%icol%",@dcContents,igrid_%icol%_list)
      DialogControlSet(OPR_Handle,"ib_OPR_igrid_%icol%",@dcSelect,igrid_%icol%)
    Next

    ;################################################################################################
    ; 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.
    ;################################################################################################

    win_track = "OPROCESS"           
    Get_Control_Movement(OPR_Handle, win_track)   

    ;################################################################################################

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

    If op_win_state == @ZOOMED Then
      WinZoom("Order Processing")
      curr_xsize  = ItemExtract(1,DialogProcOptions(OPR_Handle, @dpoClientSize,-1)," ")
      curr_ysize  = ItemExtract(2,DialogProcOptions(OPR_Handle, @dpoClientSize,-1)," ")
      ReSize_It(OPR_Handle)
    Else
      If op_win_size != "" && ItemCount(op_win_size,",") == 4 Then
        WinPlace(ItemExtract(1,op_win_size,","),ItemExtract(2,op_win_size,","),ItemExtract(3,op_win_size,","),ItemExtract(4,op_win_size,","), "Order Processing")
        curr_xsize  = ItemExtract(1,DialogProcOptions(OPR_Handle, @dpoClientSize,-1)," ")
        curr_ysize  = ItemExtract(2,DialogProcOptions(OPR_Handle, @dpoClientSize,-1)," ")
        ReSize_It(OPR_Handle)
      EndIf
    EndIf
    ;################################################################################################

    Break
  Case @deResize
    curr_xsize  = ItemExtract(1,DialogProcOptions(OPR_Handle, @dpoClientSize,-1)," ")
    curr_ysize  = ItemExtract(2,DialogProcOptions(OPR_Handle, @dpoClientSize,-1)," ")
    Resize_It(OPR_Handle)
    Break
  Case @deClose
    op_win_state = WinState("Order Processing")
    op_win_size  = WinPosition("Order Processing")
    IniWritePvt(profile,"op_win_size",op_win_size,System_Ini)
    IniWritePvt(profile,"op_win_state",op_win_state,System_Ini)
    Return 9
    Break
  Case @deIbSelect
    Switch(DialogProcOptions(OPR_Handle,@dpoCtlNumber,DCID))
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"ib_OPR_igrid_1")
        button_text = DialogControlGet(OPR_Handle,"ib_OPR_igrid_1",@dcSelect)
        button_text_list = DialogControlGet(OPR_Handle,"ib_OPR_igrid_1",@dcContents)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"ib_OPR_igrid_2")
        button_text = DialogControlGet(OPR_Handle,"ib_OPR_igrid_2",@dcSelect)
        button_text_list = DialogControlGet(OPR_Handle,"ib_OPR_igrid_2",@dcContents)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"ib_OPR_igrid_3")
        button_text = DialogControlGet(OPR_Handle,"ib_OPR_igrid_3",@dcSelect)
        button_text_list = DialogControlGet(OPR_Handle,"ib_OPR_igrid_3",@dcContents)
        Break
    EndSwitch
    Break
  Case @deIbDblclick
    Switch(DialogProcOptions(OPR_Handle,@dpoCtlNumber,DCID))
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"ib_OPR_igrid_1")
        button_text = DialogControlGet(OPR_Handle,"ib_OPR_igrid_1",@dcSelect)
        button_text_list = DialogControlGet(OPR_Handle,"ib_OPR_igrid_1",@dcContents)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"ib_OPR_igrid_2")
        button_text = DialogControlGet(OPR_Handle,"ib_OPR_igrid_2",@dcSelect)
        button_text_list = DialogControlGet(OPR_Handle,"ib_OPR_igrid_2",@dcContents)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"ib_OPR_igrid_3")
        button_text = DialogControlGet(OPR_Handle,"ib_OPR_igrid_3",@dcSelect)
        button_text_list = DialogControlGet(OPR_Handle,"ib_OPR_igrid_3",@dcContents)
        Break
    EndSwitch
    Break
  Case @dePbPush
    Switch(DialogProcOptions(OPR_Handle,@dpoCtlNumber,DCID))
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"pb_OPR_Complete_1")
        button_text = DialogControlGet(OPR_Handle,"pb_OPR_Complete_1",@dcTitle)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"pb_OPR_X1")
        button_text = DialogControlGet(OPR_Handle,"pb_OPR_X1",@dcTitle)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"pb_OPR_Complete_2")
        button_text = DialogControlGet(OPR_Handle,"pb_OPR_Complete_2",@dcTitle)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"pb_OPR_X2")
        button_text = DialogControlGet(OPR_Handle,"pb_OPR_X2",@dcTitle)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"pb_OPR_Complete_3")
        button_text = DialogControlGet(OPR_Handle,"pb_OPR_Complete_3",@dcTitle)
        Break
      Case DialogProcOptions(OPR_Handle,@dpoCtlNumber,"pb_OPR_X3")
        button_text = DialogControlGet(OPR_Handle,"pb_OPR_X3",@dcTitle)
        Break
    EndSwitch
    Break
EndSwitch
Return -2

#EndSubRoutine
 


    ;################################################################################################
    ;################################################################################################
    ;                                                                                               ;
    ;                      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.
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


  Decimals(-1)

  init_xsize%win_track%   = ItemExtract(1,DialogProcOptions(Mov_Handle, @dpoClientSize, -1)," ")
  init_ysize%win_track%   = ItemExtract(2,DialogProcOptions(Mov_Handle, @dpoClientSize, -1)," ")

 
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;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

  If win_track == "OPROCESS" Then

    arr_txt = arr_txt:"pb_OPR_Complete_1,              POS_FIX,                                  1,            1,            1,            1":@CR
    arr_txt = arr_txt:"vt_OPR_station_1,               POS_FIX,                                  1,            1,            1,            1":@CR
    arr_txt = arr_txt:"vt_OPR_ord_num_c_1,             POS_FIX,                                  1,            1,            1,            1":@CR
    arr_txt = arr_txt:"pb_OPR_X1,                      POS_MOVE_H,                    .33333333334,            1,            1,            1":@CR
    arr_txt = arr_txt:"ib_OPR_igrid_1,                 POS_GROW_H|POS_GROW_V,                    1, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"pb_OPR_Complete_2,              POS_MOVE_H,                    .33333333334, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"vt_OPR_station_2,               POS_MOVE_H,                    .33333333334, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"vt_OPR_ord_num_c_2,             POS_MOVE_H,                    .33333333334, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"pb_OPR_X2,                      POS_MOVE_H,                    .66666666667, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"ib_OPR_igrid_2,                 POS_MOVEGROW_H|POS_GROW_V,     .33333333334, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"pb_OPR_Complete_3,              POS_MOVE_H,                    .66666666667, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"vt_OPR_station_3,               POS_MOVE_H,                    .66666666667, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"vt_OPR_ord_num_c_3,             POS_MOVE_H,                    .66666666667, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"pb_OPR_X3,                      POS_MOVE_H,                               1, .33333333334,            1,            1":@CR
    arr_txt = arr_txt:"ib_OPR_igrid_3,                 POS_MOVEGROW_H|POS_GROW_V,     .66666666667, .33333333334,            1,            1"

  EndIf

  arr_txt = StrReplace(arr_txt," ","")
  o_array%win_track% = Arrayize(arr_txt,@CR)
  ArrayRedim(o_array%win_track%,-1,7)
  xcnt = ArrInfo(o_array%win_track%,1)-1
  For x = 0 to xcnt
     txt = o_array%win_track%[x,0]
     o_array%win_track%[x,5] = ItemExtract(6,txt,",")
     o_array%win_track%[x,4] = ItemExtract(5,txt,",")
     o_array%win_track%[x,3] = ItemExtract(4,txt,",")
     o_array%win_track%[x,2] = ItemExtract(3,txt,",")
     o_array%win_track%[x,1] = ItemExtract(2,txt,",")
     o_array%win_track%[x,0] = ItemExtract(1,txt,",")
     If x > 0 Then o_array%win_track%[x,6] = DialogControlGet(Mov_Handle,o_array%win_track%[x,0],@dcPosition)
  Next
 
 
#EndSubRoutine


#DefineFunction Set_Control_Movement(Mov_Handle,xy,xdiff,ydiff,xt,yt,xb,yb,o_array)

  POS_FIX             =  0 ; Allow Move/Resize of Control                         
  POS_GROW_H          =  1 ; Fixed Position but grow Horizontally                 
  POS_GROW_V          =  2 ; Fixed Position but grow Vertically                   
  POS_MOVE_H          =  4 ; Move Horizontally with Resize but no growth           
  POS_MOVE_V          =  8 ; Move Vertically with Resize but no growth             
  POS_MOVEGROW_H      = 16 ; Grow and Move Horizontally
  POS_MOVEGROW_V      = 32 ; Grow and Move Vertically

  Decimals(-1)
  tvar     = o_array[xy,0]
  move_var = o_array[xy,1]
  ocutx_m  = o_array[xy,2]
  ocutx_g  = o_array[xy,3]
  ocuty_m  = o_array[xy,4]
  ocuty_g  = o_array[xy,5]


  xt_m_adj = 0
  yt_m_adj = 0
  xb_g_adj = 0
  yb_g_adj = 0

  If xt+(xdiff*%ocutx_m%) < 0 Then xt_m_adj = (xt+(xdiff*%ocutx_m%))*-1
  If yt+(ydiff*%ocuty_m%) < 0 Then yt_m_adj = (yt+(ydiff*%ocuty_m%))*-1
  If xb+(xdiff*%ocutx_g%) < 0 Then xb_g_adj = (xb+(xdiff*%ocutx_g%))*-1
  If yb+(ydiff*%ocuty_g%) < 0 Then yb_g_adj = (yb+(ydiff*%ocuty_g%))*-1

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  Decimals(0)

  If %move_var% & POS_FIX Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt:" ":yt:" ":xb:" ":yb)
    Return 
  EndIf
  If %move_var% & POS_MOVE_H && %move_var% & POS_MOVEGROW_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt+(xdiff*%ocutx_m%)+xt_m_adj:" ":yt+(ydiff*%ocuty_m%)+yt_m_adj:" ":xb:" ":yb+(ydiff*%ocuty_g%)+yb_g_adj)
    Return 
  EndIf
  If %move_var% & POS_MOVE_H && %move_var% & POS_GROW_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt+(xdiff*%ocutx_m%)+xt_m_adj:" ":yt:" ":xb:" ":yb+(ydiff*%ocuty_g%)+yb_g_adj)
    Return 
  EndIf
  If %move_var% & POS_MOVE_V && %move_var% & POS_GROW_H Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt:" ":yt+(ydiff*%ocuty_m%)+yt_m_adj:" ":xb+(xdiff*%ocutx_g%)+xb_g_adj:" ":yb)
    Return 
  EndIf
  If %move_var% & POS_MOVE_V && %move_var% & POS_MOVEGROW_H Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt+(xdiff*%ocutx_m%)+xt_m_adj:" ":yt+(ydiff*%ocuty_m%)+yt_m_adj:" ":xb+(xdiff*%ocutx_g%)+xb_g_adj:" ":yb)
    Return 
  EndIf
  If %move_var% & POS_GROW_H && %move_var% & POS_MOVEGROW_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt:" ":yt+(ydiff*%ocuty_m%)+yt_m_adj:" ":xb+(xdiff*%ocutx_g%):" ":yb+(ydiff*%ocuty_g%)+yb_g_adj)
    Return 
  EndIf
  If %move_var% & POS_GROW_V && %move_var% & POS_MOVEGROW_H Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt+(xdiff*%ocutx_m%)+xt_m_adj:" ":yt:" ":xb+(xdiff*%ocutx_g%)+xb_g_adj:" ":yb+(ydiff*%ocuty_g%)+yb_g_adj)
    Return 
  EndIf
  If %move_var% & POS_MOVE_H && %move_var% & POS_MOVE_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt+(xdiff*%ocutx_m%)+xt_m_adj:" ":yt+(ydiff*%ocuty_m%)+yt_m_adj:" ":xb:" ":yb)
    Return 
  EndIf
  If %move_var% & POS_MOVE_H Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt+(xdiff*%ocutx_m%)+xt_m_adj:" ":yt:" ":xb:" ":yb)
    Return 
  EndIf
  If %move_var% & POS_MOVE_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt:" ":yt+(ydiff*%ocuty_m%)+yt_m_adj:" ":xb:" ":yb)
    Return 
  EndIf
  If %move_var% & POS_GROW_H && %move_var% & POS_GROW_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt:" ":yt:" ":xb+(xdiff*%ocutx_g%)+xb_g_adj:" ":yb+(ydiff*%ocuty_g%)+yb_g_adj)
    Return 
  EndIf
  If %move_var% & POS_GROW_H Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt:" ":yt:" ":xb+(xdiff*%ocutx_g%)+xb_g_adj:" ":yb)
    Return 
  EndIf
  If %move_var% & POS_GROW_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt:" ":yt:" ":xb:" ":yb+(ydiff*%ocuty_g%)+yb_g_adj)
    Return 
  EndIf
  If %move_var% & POS_MOVEGROW_H && %move_var% & POS_MOVEGROW_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt+(xdiff*%ocutx_m%)+xt_m_adj:" ":yt+(ydiff*%ocuty_m%)+yt_m_adj:" ":xb+(xdiff*%ocutx_g%)+xb_g_adj:" ":yb+(ydiff*%ocuty_g%)+yb_g_adj)
    Return 
  EndIf
  If %move_var% & POS_MOVEGROW_H Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt+(xdiff*%ocutx_m%)+xt_m_adj:" ":yt:" ":xb+(xdiff*%ocutx_g%)+xb_g_adj:" ":yb)
    Return 
  EndIf
  If %move_var% & POS_MOVEGROW_V Then
    DialogControlSet(Mov_Handle,tvar,@dcPosition,xt:" ":yt+(ydiff*%ocuty_m%)+yt_m_adj:" ":xb:" ":yb+(ydiff*%ocuty_g%)+yb_g_adj)
    Return 
  EndIf

#EndFunction
 
#DefineSubRoutine Resize_it(Mov_Handle)

  Decimals(-1)
  xdiff   = curr_xsize - init_xsize%win_track%
  ydiff   = curr_ysize - init_ysize%win_track%

  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;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.
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    xcnt = ArrInfo(o_array%win_track%,1)-1
    For xy = 1 to xcnt
      xt = ItemExtract(1,o_array%win_track%[xy,6]," ")
      yt = ItemExtract(2,o_array%win_track%[xy,6]," ")
      xb = ItemExtract(3,o_array%win_track%[xy,6]," ")
      yb = ItemExtract(4,o_array%win_track%[xy,6]," ")
      Decimals(0)
      Set_Control_Movement(Mov_Handle,xy,xdiff,ydiff,xt,yt,xb,yb,o_array%win_track%)
      Decimals(-1)
      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      ;Refresh the Control as it doesn't always redraw correctly.  PictureButtons, Bitmaps and Calendars are excluded from refresh.
      tvar = o_array%win_track%[xy,0]

      ;##########################################;
      ;Code that uses MY Control Naming that may need to be changed.  pn = PictureButton, pi = Bitmap and ca = Calendar
      ;##########################################;

      If StrSub(tvar,1,3) != "pn_" && StrSub(tvar,1,3) != "pi_" && StrSub(tvar,1,3) != "ca_" Then
        DialogControlSet(Mov_Handle,tvar,11,DialogControlGet(Mov_Handle,tvar,11))
      EndIf
    Next

#EndSubRoutine


Return



Title: Re: Resize/Move Example
Post by: kdmoyers on January 17, 2017, 09:17:19 AM
Awesome as always Jim, thanks!!
-Kirby