kiboost Posted October 14, 2010 Share Posted October 14, 2010 Hi, I'm creating a script that check and list a few things, and for each thing, create some buttons and label. So, is there a way to put a variable in a button name, for example like this : $Bt_&$k = GUICtrlCreateButton("", $left, $top, 40, 20) So I can then, knowing k number, change its state by calling it $Bt_20 (if k=20) ? Secondly, is there a way to have a button that show a text when mouse is over it ? Not changing its state, but showing a little text beside the mouse cursor, just like "title" balise in html ? cheers, Kib Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 14, 2010 Moderators Share Posted October 14, 2010 kiboost,The easiest way to do what you want is to use an array to hold the button ControlIds. You can set "little texts" by using GUICtrlSetTip. Take a look at this to see what I mean:#include <GUIConstantsEx.au3> ; Declare the array Global $hButtonID[3] $hGUI = GUICreate("Test", 500, 500) ; Create buttons and store ControlIDs in the array $hButtonID[0] = GUICtrlCreateButton("Button 0", 10, 10, 80, 30) $hButtonID[1] = GUICtrlCreateButton("Button 1", 10, 50, 80, 30) $hButtonID[2] = GUICtrlCreateButton("Button 2", 10, 90, 80, 30) ; Set tooltips For $i = 0 To 2 GUICtrlSetTip($hButtonID[$i], "Button " & $i) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButtonID[0] ; Disable Buton 2 GUICtrlSetState($hButtonID[2], $GUI_DISABLE) Case $hButtonID[1] ; Enable Buton 2 GUICtrlSetState($hButtonID[2], $GUI_ENABLE) EndSwitch WEndPlease ask if you have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kiboost Posted October 14, 2010 Author Share Posted October 14, 2010 (edited) many thanks, I had indeed to declare the array before. $hButtonID[$k] = GUICtrlCreateButton("Button 0", 10, 10, 80, 30) it works ! Now, how can I get the position (specially top position) of a button ? Doesn't seems to be GUICtrlGetPos ! I could register them into another array anyway ... I need to change the button when I click on it, and remap the function it will call then. Edited October 14, 2010 by kiboost Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79 Link to comment Share on other sites More sharing options...
kiboost Posted October 14, 2010 Author Share Posted October 14, 2010 ok, ControlGetPos !! Thanks again ;-) Any thought about the rollover ? Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 14, 2010 Moderators Share Posted October 14, 2010 kiboost,If by "rollover" you mean showing a small text window when you put the mouse over a control then I already showed you how to use GUICtrlSetTip in the code I posted. If not, then what do you mean by "rollover"? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kiboost Posted October 14, 2010 Author Share Posted October 14, 2010 GOSH, I missed this one ! Works exactly like I need, you just made my day !! Many thanks, again ! Cheers :-) Kib Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79 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