Splitter

Splitter control.

(see splitter.png)

Splitter is control that is created between controls that need to have dynamic separation.  To use it, you first need to create the splitter using Add function, then you have to activate it with Set function when all controls that it separates are created.

You can set splitter position with SetPos and obtain it with GetPos.  You can also limit splitter movement with Set function and its “Limit” parameter if you don’t want controls it separates to be set completely invisible by the user.

Dependency

Win 1.24

Effects

  • While user moves splitter, CoordMode of mouse is always returned to relative.
  • Upon movement, splitter will reset Attach for the parent, if present.
Summary
SplitterSplitter control.
AddAdd new Splitter.
Add2FormAdd Splitter into the form.
GetMaxReturns maximum position of the splitter.
GetMinReturns minimum position of the splitter.
GetPosGet position of the splitter.
GetSizeGet size of the splitter.
SetInitiates separation of controls.
SetPosSet splitter position.
Examples
About

Add

Splitter_Add(Opt = "",
Text = "",
Handler = "")

Add new Splitter.

Parameters

OptSplitter Gui options.  Splitter is subclassed Text control (Static), so it accepts any Text options. plus one the following: blackframe, blackrect, grayframe, grayrect, whiteframe, whiterect, sunken.
TextText to set.
HandlerNotification function.  See bellow.

Handler

OnSplitter(Hwnd, Event, Pos)
PTriggered when user changes the position by dragging the splitter with mouse.
DUser doubleclicked the splitter.
RUser right clicked the splitter.

Returns

Splitter handle.

Remarks

This function adds a new splitter on the given position.  User is responsible for correct position of the splitter.  Splitter is inactive until you call Set function.  When setting dimension of the splitter (width or height) use even numbers.

Add2Form

Splitter_Add2Form(HParent,
Txt,
Opt)

Add Splitter into the form.

Options

handlerSplitter handler name.
extraExtra parameters are transmited to Add Opt parameter.

Remarks

Function is required by the Forms framework.

GetMax

Splitter_GetMax(HSep)

Returns maximum position of the splitter.

Remarks

Maximum position of the splitter will change if parent control is resized.

GetMin

Splitter_GetMin(HSep)

Returns minimum position of the splitter.

GetPos

Splitter_GetPos(HSep,  
Flag = "")

Get position of the splitter.

Parameters

FlagSet to “%” to return procentage instead position.

Remarks

Position of the splitter is its x or y coordinate inside the parent window.

GetSize

Splitter_GetSize(HSep)

Get size of the splitter.

Set

Splitter_Set(HSep,  
Def,  
Pos = "",
Limit = 0.0)

Initiates separation of controls.

Parameters

HSepSplitter handle.
DefSplitter definition or words “off” or “on”.  The syntax of splitter definition is given bellow.
PosPosition of the splitter to apply upon initialization (optional).
LimitDecimal, sets start and end limits for splitter movement.  The minimum and maximum splitter value will be adjusted by this value.  For instance, .100 means that maximum value will be less by 100.

Splitter Defintion

c11 c12 c13 ... Type c21 c22 c23 ...
c1nControls left or top of the splitter.
TypeSplitter type: “ | “ vertical or “ - “ horizontal.
c2nControls right or bottom of the splitter.

SetPos

Splitter_SetPos(HSep,  
Pos,  
bInternal = false)

Set splitter position.

Parameters

HSepSplitter handle.
PosPosition to set.  Position is the client x/y coordinate of the splitter control.  If followed by the sign %, position is set using procentage of splitter range.  If Pos is empty, function returns without any action.

Remarks

Due to the rounding, if you set position using procentage, actuall position may be slightly different.  You can find out what is exact position set if you use GetPos with Flag set to “%”.

Examples

    w := 500, h := 600, sep := 5
    w1 := w//3, w2 := w-w1 , h1 := h // 2, h2 := h // 3

    Gui, Margin, 0, 0
    Gui, Add, Edit, HWNDc11 w%w1% h%h1%
    Gui, Add, Edit, HWNDc12 w%w1% h%h1%
    hSepV := Splitter_Add( "x+0 y0 h" h " w" sep )
    Gui, Add, Monthcal, HWNDc21 w%w2% h%h2% x+0
    Gui, Add, ListView, HWNDc22 w%w2% h%h2%, c1|c2|c3
    Gui, Add, ListBox,  HWNDc23 w%w2% h%h2% , 1|2|3

    sdef = %c11% %c12% | %c21% %c22% %c23%          ;vertical splitter.
    Splitter_Set( hSepV, sdef )

    Gui, show, w%w% h%h%
return

About

Splitter_Add(Opt = "",
Text = "",
Handler = "")
Add new Splitter.
Splitter_Add2Form(HParent,
Txt,
Opt)
Add Splitter into the form.
Splitter_GetMax(HSep)
Returns maximum position of the splitter.
Splitter_GetMin(HSep)
Returns minimum position of the splitter.
Splitter_GetPos(HSep,  
Flag = "")
Get position of the splitter.
Splitter_GetSize(HSep)
Get size of the splitter.
Splitter_Set(HSep,  
Def,  
Pos = "",
Limit = 0.0)
Initiates separation of controls.
Splitter_SetPos(HSep,  
Pos,  
bInternal = false)
Set splitter position.
Set of window functions.
Attach(hCtrl = "",
aDef = "")
Determines how a control is resized with its parent.
Close