User Tools

Site Tools


prop_snapheight.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:SnapHeight and PROP:SnapWidth ====== Previous pageReturn to chapter overviewNext page

PROP:SnapHeight sets the snap height of any window or dockable toolbox when it is resized. When a toolbox is repositioned from vertical docking to horizontal docking, it is resized and adjusted according to the PROP:SnapHeight and PROPSnapWidth values.

PROP:SnapWidth sets the snap width of any window or dockable toolbox when it is resized. When a toolbox is repositioned from vertical docking to horizontal docking, it is resized and adjusted according to the PROP:SnapHeight and PROP:SnapWidth values.

See Also:

DOCK, DOCKED, TOOLBOX

Example:

PROGRAM

MAP

  Main

  P1(STRING)

END

CODE

Main

Main PROCEDURE

Window APPLICATION('SnapWidth & SnapHeight'),AT(,,262,243),STATUS,MAX,RESIZE

      END

CODE

OPEN(window)

Window{PROP:StatusText} = 'Drag the toolbar to any edge'

ACCEPT

  IF EVENT()=Event:OpenWindow

    START(P1,,system{PROP:target})

   

  END

END

P1 PROCEDURE(w)

win &WINDOW

width   SIGNED

height  SIGNED

window WINDOW,AT(50,50,100,20),SYSTEM,TOOLBOX,GRAY,RESIZE,MDI,IMM

        BUTTON,AT(80,2,15,15),USE(?Button4),ICON(ICON:Cut),FLAT

        BUTTON,AT(31,2,15,15),USE(?Button2),ICON(ICON:Copy),FLAT

        BUTTON,AT(55,2,15,15),USE(?Button3),ICON(ICON:Paste),FLAT

      END

! | | !  Using SnapWidth and SnapHeight, sets up “n” possible sizes for a TOOLBOX.  In this   | | !  example, when the toolbox is docked to the left or right, it takes on the Tall size | | !  When Top or Botton, it takes the Wide size.             | | !

  CODE

  win &= (w)

  OPEN(window, win)

  WINDOW{PROP:docked} = Dock:Float

  window{PROP:dock} = DOCK:ALL

  window{PROP:snapwidth, 1} = 20   !  Vertical size i.e., when made tall

  window{PROP:snapheight, 1} = 150

  window{PROP:snapwidth, 2} = 100  !  Horizontal size i.e., when made wide

  window{PROP:snapheight, 2} = 20

  window{PROP:snapwidth, 3} = 50   !  square

  window{PROP:snapheight, 3} = 50

 

  ACCEPT

   

    IF EVENT() = EVENT:sized

     ! handle repositioning of buttons here

      IF window{PROP:Width} = 20  ! is it tall?

        ?Button4{PROP:xpos} = 2

        ?Button4{PROP:ypos} = 53

        ?Button2{PROP:xpos} = 2

        ?Button2{PROP:ypos} = 19

        ?Button3{PROP:xpos} = 2

        ?Button3{PROP:ypos} = 36

      ELSIF window{PROP:Width} = 100 ! Is it wide?

        ?Button4{PROP:xpos} = 70

        ?Button4{PROP:ypos} = 2

        ?Button2{PROP:xpos} = 50

        ?Button2{PROP:ypos} = 2

        ?Button3{PROP:xpos} = 30

        ?Button3{PROP:ypos} = 2

      ELSE                          !it must be square

        ?Button4{PROP:xpos} = 27

        ?Button4{PROP:ypos} = 27

        ?Button2{PROP:xpos} = 27

        ?Button2{PROP:ypos} = 10

        ?Button3{PROP:xpos} = 5

        ?Button3{PROP:ypos} = 27

      END

    END

  END

prop_snapheight.htm.txt · Last modified: 2021/04/15 15:57 (external edit)