Here's one of the buttons i have to type:
Func _btnName($x1) If _Convert2Number($mNameREG) < _Convert2Number($mNameINI) Then $mbtnName = GUICtrlCreateButton(_CheckInstall($mNameINI), $mCol05, ($mXpos + ($mMultiplier * $x1)) - 4, $mWidth, $mHeight, 1) GUICtrlSetOnEvent(-1, "_NameClick") _SetFont() Else _LabelCreate(_CheckInstall($mNameREG), $mCol05, $mXpos + ($mMultiplier * $x1), $mWidth, $mHeight, 1) EndIf EndFunc
The only variable i have feeding into this function is an offset number and NAME could be anything You want. i further have an .INI file that contains the current available version that i check against the system registry then convert both inputs to numbers (to see which one is greater), finally display the button if necessary. i've tried creating a function that encapsulates this into one function, but on clicking it doesn't go where i point it to.
Is it possible to get a $btnName as i intend or do i have to do this long-hand?
Func _CreateButton($x1, $x2, $x3, $x4, $x5) ;$x1 = Registry variable ;$x2 = INI variable ;$x3 = Button Name ;$x4 = OnClick Event ;$x5 = Offset Number If _Convert2Number($x1) < _Convert2Number($x2) Then $x3 = GUICtrlCreateButton(_CheckInstall($x2), $mCol05, ($mXpos + ($mMultiplier * $x5)) - 4, $mWidth, $mHeight, 1) GUICtrlSetOnEvent(-1, $x4) _SetFont() Else _labelCreate(_CheckInstall($mX1), $mCol05, $mXpos + ($mMultiplier * $x5), $mWidth, $mHeight, 1) EndIf MsgBox(0, "Vars", "$x1 = " & $x1 & @CRLF & _ "$x2 = " & $x2 & @CRLF & _ "$x3 = " & $x3 & @CRLF & _ "$x4 = " & $x4 & @CRLF & _ "$x5 = " & $x5) EndFunc
The MsgBox shows the variables i send and what i intend is that $x3 should be a $btnNAME. Instead i get a number that bears no relation to anything i'm aware of. (on the first button in my form i get a "7".)