kjactive Posted March 12, 2005 Posted March 12, 2005 (edited) I have a window with different controls that I want to be able to change styles to all controls - I created the default style settings as a variable that get loaded in from an external text file but this don't work... $tm[6] = $BS_BOTTOM+$BS_FLAT GUICtrlCreateButton ("Push style", 100 , 100, 100 , 22 , $tm[6] ) // works $tm[6] = StringMid($tm[6],2,StringLen($tm[6])-2) // $BS_BOTTOM+$BS_FLAT GUICtrlCreateButton ("Push style", 100 , 100, 100 , 22 , $tm[6] ) // don't work Why is this - is it not posible to get control styles from external preferences file into an variable like in the last example or do I have to init this variable in some special manner something like a Value($tm[6]) - any suggestens! Kåre Edited March 12, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc...
Coffee Posted March 12, 2005 Posted March 12, 2005 There are a few problems here. Firstly when combining styles always use Bitor($style, $style) and not $sytle+$style You may store your values anywhere, be it in your script, .ini file, registry etc. However to set a value to a variable you must use its value and not it's name. This works: #include <GUIConstants.au3> $string = "0x0800+0x8000" $split = stringsplit($string, "+", 1) $gui = Guicreate("Mygui") $button1 = GUICtrlCreateButton("Push Style", 10, 100, 70, 70, BitOR($split[1], $split[2])) GUISetState() while 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button1 MsgBox(0, "status", "yay! I look correct") EndSelect WEnd However this does not: #include <GUIConstants.au3> $string = "$BS_BOTTOM+$BS_FLAT" $split = stringsplit($string, "+", 1) $gui = Guicreate("Mygui") $button1 = GUICtrlCreateButton("Push Style", 10, 100, 70, 70, BitOR($split[1] , $split[2])) GUISetState() while 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button1 MsgBox(0, "status", ":( I look fubar :(") EndSelect WEnd
kjactive Posted March 13, 2005 Author Posted March 13, 2005 (edited) Thaks for your responce - I know that the $BS_BOTTOM etc. are variabes declared as globals in the #include <GUIConstants.au3> and as this should be available at all time internal in the script and my variables are strings but what I miss is a function to change my string into the variable like something like this variable $BS_BOTTOM = Value(string $BS_BOTTOM) - Is this not posible in au3, I tryed Eval and assign without luck and can't quiet get why as they are available globals... Thanks for the correction on BitOr - Ofcourse... Kåre Edited March 13, 2005 by kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc...
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