Jump to content

_GuiCtrlCreateButtons - Create Many Buttons


GordonFreeman
 Share

Recommended Posts

This function creates many buttons. You need adapt to your needs.

;$iAmount = Amount of the button controls
;$iMaxByLine = Max buttons per line. If 5 Then " [1] [2] [3] [4] [5] "
;$iLeft = Left position of the first button, you can create a button in Koda in your GUI and get this
;$iTop = Top position of the first button, you can create a button in Koda in your GUI and get this
;$iWidht = Widht of all buttons, you can create a button in Koda in your GUI and get this
;$iHeight = Height of all buttons, you can create a button in Koda in your GUI and get this
;$iHorizontalDist = Distance between buttons of the same line like " [1]--[2] " / DEFAULT: 0
;$iVerticalDist = Distance between buttons of the column like " [1] " / DEFAULT: 0
;                                                                |
;                                                                |
;                                                               [2]
;
;RETURN:
;   Return an array who first element is the Amount of buttons and the rest is the handle to the button controls
;   EXAMPLE:
;   $aButtons[0]=100
;   $aButtons[100]= {HANDLE OF THE LAST BUTTON}

Func _GuiCtrlCreateButtons($iAmount,$iMaxByLine,$iLeft,$iTop,$iWidht,$iHeight,$iHorizontalDist = 0,$iVerticalDist = 0)

Local $aButtons[$iAmount+1]

Local $iStartLeft = $iLeft

For $i = 1 to $iAmount

If $i <> 1 Then
$iLeft += $iWidht + $iHorizontalDist

If Mod($i-1,$iMaxByLine) Then

Else

$iLeft = $iStartLeft
$iTop += $iHeight + $iVerticalDist

EndIf

EndIf

$aButtons[$i] = GUICtrlCreateButton($i,$iLeft,$iTop,$iWidht,$iHeight)

Next

$aButtons[0] = $iAmount

Return $aButtons

EndFunc;==>_GuiCtrlCreateButtons

 

Edited by GordonFreeman
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...