Tankbuster Posted May 6, 2010 Share Posted May 6, 2010 Hello, I think this is already solved, as I image I not the first one, but sorry I was not able to get a helping post (or manual entry). Could someone please so kind to guide me to the solution (link, page ?) Let me explain my problem: I created a menu of buttons, dynamical changing text is displayed after the user pressed a button. A top menu is displaying 8 buttons, than user presses button 2 and the sub menu 2 consisting of again of several buttons is displayed. So actually I got two button types, one is referring to a sub menu and the other type is for EXECUTING something. To show this difference to the user I choose to have different colours. Up to this point everything is working perfect, but I'm not able to set Color to the buttons without "removing" the style, and setting the Style removes the colour.... I created a abstract example to show you my issue: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ButtonConstants.au3> Opt('MustDeclareVars', 0) dim $testbutton[5] Consolewrite(@AutoItVersion) GUICreate("My GUI style") ; will create a dialog box that when displayed is centered for $i=1 to 4 $testbutton[$i]=GUICtrlCreateButton("Test",10,10+(30*$i),100,30,$BS_RIGHT) Next Example() Func Example() Local $msg for $i=1 to 4 GUICtrlSetBkColor($testbutton[$i],0x88bbff) GUICtrlSetStyle($testbutton[$i], $BS_RIGHT) Next GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example In the example based on the manual I create 4 buttons and later I want to change the colour. If I start the script with the code above, the text is only right justified and the button background is default windows. By remarking the line 20 (GUICtrlSetStyle($testbutton[$i], $BS_RIGHT)) the colour is correct but the text is now in the center. How does these tow features work together? Is it possible? I know the manual states, that some objects can't be modified, but as I saw that each line for itself is working why not together? If you post me a link or a post number I really appreciated your effort. Thank you. (PS: BTW: No setting the color and style on GUICtrlCreateButton line is not an option, because I want to have the buttons dynamical changed) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 6, 2010 Moderators Share Posted May 6, 2010 Tankbuster, As was discussed recently in this topic, it seems that you cannot combine button colours and styles. There is also a longstanding bug #376 regarding coloured buttons trapping the Enter key, so I try to avoid them. Sorry to be so negative - I will try to be more helpful next time! 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...
Tankbuster Posted May 6, 2010 Author Share Posted May 6, 2010 Sorry to be so negative - I will try to be more helpful next time! M23In fact this is very helpful, at least I could close the try and search way :-)Next time I will search the bug list (I promise......note it to my-self-bug-list ...hahaha) 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