# Splitter

Splitter control.

Splitter is control that is created between controls that need to have dynamic separation. To use it, you first need to create the splitter (Add), then you have to activate it when all controls that it separates are created (Set). You can set splitter position with SetPos and obtain it with GetPos. You can also limit splitter movement with <Limit> function 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

Splitter | Splitter control.
Add | Add new Splitter.
Add2Form | Add Splitter into the form.
GetMax | Returns maximum position of the splitter.
GetPos | Get position of the splitter.
GetSize | Get size of the splitter.
Set | Initiates separation of controls.
SetPos | Set splitter position.
Examples |
About |

### Add

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

Add new Splitter.

#### Parameters

Opt | Splitter 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.
Text | Text to set.
Handler | Notification function. See bellow.

#### Handler

>     OnSplitter(Hwnd, Event, Pos)

P | Triggered when user changes the position by dragging the splitter with mouse.
D | User doubleclicked the splitter.
R | User 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

handler | Splitter handler name.
extra | Extra 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.

### GetPos

> Splitter_GetPos( | HSep, |  |
> | Flag | = | "" | )

Get position of the splitter.

#### Parameters

Flag | Set 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

HSep | Splitter handle.
Def | Splitter definition or words “off” or “on”. The syntax of splitter definition is given bellow.
Pos | Position of the splitter to apply upon initialization (optional).
Limit | Decimal, 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 ...

c1n | Controls left or top of the splitter.
Type | Splitter type: “ | “ vertical or “ - “ horizontal.
c2n | Controls right or bottom of the splitter.

### SetPos

> Splitter_SetPos( | HSep, |  |
> | Pos, |  |
> | bInternal | = | false | )

Set splitter position.

#### Parameters

HSep | Splitter handle.
Pos | Position 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

- Ver 1.6 by majkinetor.
- Licenced under BSD http://creativecommons.org/licenses/BSD/.

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