Chimaera Posted February 28, 2016 Share Posted February 28, 2016 Hi, ive got a gui with a number of buttons which i might need to add buttons too as i go along example button code Local $hButton1 = GUICtrlCreateButton("", 6, 6, 70, 70, $BS_BITMAP, $WS_EX_WINDOWEDGE) Local $Dir1 = @ScriptDir & '\settings\button_1\' $search = FileFindFirstFile($Dir1 & '*.bmp') If @error = 1 Or $search = -1 Then GUICtrlSetImage($hButton1, @AppDataDir & '\Toolz\question_large.bmp') Else While 1 $find = FileFindNextFile($search) If @error Then ExitLoop $IconTest_1 = $find $image = GUICtrlSetImage($hButton1, $Dir1 & $IconTest_1) WEnd EndIf Local $ToolTip_1 = IniRead($IniFile, 'Button_1', 'button_1_tooltip', 'Error Reading Button 1 Tooltip') GUICtrlSetTip(Default, ' ' & $ToolTip_1 & ' ') Now the problem is, if i copy that and paste to make a new button i end up having to change the '1' at the end of each part so it relates to button 24 for eg Ive been messing about trying to make it work with stuff like this $hButton = 'Button', $bNumber = '_1' $bBut_ID = '$bBut_ID' & $bNumber ConsoleWrite($bBut_ID & @CRLF) $bBut_ID = $hButton & $bNumber ConsoleWrite($bBut_ID & @CRLF) But then the Case statement for the button doesnt work. Is there a simple way to do this? so i can edit one number and the whole button section changes? and still works with the case statement If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
AutoBert Posted February 28, 2016 Share Posted February 28, 2016 Use a Array to store the CtrlID of the button. Or use OnEventMode and set all Buttons to the same func. @GuiCtrlID helps you to identify which button has throwed the event. For extended help post a runable reproducer. Link to comment Share on other sites More sharing options...
JohnOne Posted February 28, 2016 Share Posted February 28, 2016 A runnable script would help. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now