Jump to content
Sign in to follow this  
Dieuz

Gui Case Help

Recommended Posts

Dieuz

Hi, I have cases in my gui and they are all the same, the only problem is that I dont want to type them manually cause it will take too much time.

Case $msg = $Grid_0
            GuiCtrlSetImage($Grid_0, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "0", $Type)
            
        Case $msg = $Grid_1
            GuiCtrlSetImage($Grid_1, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "1", $Type)
            
        Case $msg = $Grid_2
            GuiCtrlSetImage($Grid_2, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "2", $Type)
            
        Case $msg = $Grid_3
            GuiCtrlSetImage($Grid_3, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "3", $Type)
            
        Case $msg = $Grid_4
            GuiCtrlSetImage($Grid_4, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "4", $Type)
            
        Case $msg = $Grid_5
            ;....
        Case $msg = $Grid_6
            ;....
        Case $msg = $Grid_7
            ;...



; and so on till 255

The $Grid_ variable goes up to 255 and the number that it write in the Ini file goes also to 255. I dont want to type the same pattern till 255, how can I make a code that will help me?

Share this post


Link to post
Share on other sites
martin

Hi, I have cases in my gui and they are all the same, the only problem is that I dont want to type them manually cause it will take too much time.

Case $msg = $Grid_0
            GuiCtrlSetImage($Grid_0, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "0", $Type)
            
        Case $msg = $Grid_1
            GuiCtrlSetImage($Grid_1, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "1", $Type)
            
        Case $msg = $Grid_2
            GuiCtrlSetImage($Grid_2, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "2", $Type)
            
        Case $msg = $Grid_3
            GuiCtrlSetImage($Grid_3, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "3", $Type)
            
        Case $msg = $Grid_4
            GuiCtrlSetImage($Grid_4, $File1)
            IniWrite(@SCRIPTDIR & "\Config.ini", "Grid", "4", $Type)
            
        Case $msg = $Grid_5
            ;....
        Case $msg = $Grid_6
            ;....
        Case $msg = $Grid_7
            ;...
; and so on till 255
oÝ÷ Ù8^Ó~®'oj¸nW ¡ë.¦Ú6ç§vØ^éz»ajح¸­z)íâ'ø¥z
±©l¢Ú6ç¢{pj{m¢Ü©zØ^±©¥«mz¹íYvçhÁƧ"f¤y§(uëajÜ"X^þ«¨µæ(ºwvÚ­æ­y©Ú®¶²¡ûa{Mú¸rí®ljëh×6
Dim Grid[256];EDIT changed to 256 after PsaltyDS pointed out error in later post

for $gn = 1 to 255
 $Grid[$gn] =  GuiCtrlCreate...("....",$starx + $gn * $horizpsacing, ....etc
nextoÝ÷ Ù8^*.q©ájwezØ^Ó~¦² bëaÆ®¶­sbf÷"b33c¶vâÒFò#SP¢bb33c¶×6rÒb33c¶w&E²b33c¶våÒFVà¢wV7G&Å6WDÖvRb33c´w&E²b33c¶våÒÂb33c´fÆS¢æw&FR45$DD"fײgV÷C²b3#´6öæfræægV÷C²ÂgV÷C´w&BgV÷C²Âb33c¶vâÂb33cµGR¢WFÆö÷¶bf÷VæBBFVâæòæVVBFò¶WÆöö¶æp¢VæF`¢æW@ ¢66Rb33c¶×6rÒâââæ÷FW"66W0
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
PsaltyDS

You need to create an array of the $Grid controls

Dim Grid[255]

for $gn = 1 to 255
 $Grid[$gn] =  GuiCtrlCreate...("....",$starx + $gn * $horizpsacing, ....etc
nextoÝ÷ Ûú®¢×ªëk(¬uçâ+^+ay©ìÁêãºËkzg¦mêíì­íjÇbjw¢¶«uç%j·°Øvç¥zg§¶Í-»¶ç+uç%j·°Øv秥zg§¶Æ§v('¢·´ºÈ§[a®í¹å«­¢+Ù¥´ÀÌØíÉ¥lÈÔÙt()½ÈÀÌØí¸ôÄѼÈÔÔ(ÀÌØíÉ¥lÀÌØí¹tôÕ¥
Ñɱ
ÉѸ¸¸ ÅÕ½Ð츸¸¸ÅÕ½Ðì°ÀÌØíÍÑÉà¬ÀÌØí¸¨ÀÌØí¡½É¥éÁÍ¥¹°¸¸¸¹Ñ)¹áÐoÝ÷ ØÌ©z»(©i­çÞ­éÜz+-¢z-«Þ¶'£ayÊ.Ö¡y§h~ئy«­¢+Ø¥¹±Õ±ÐíÉÉä¹ÔÌÐì()¥´ÀÌØíÉ¥lÅtôlÁt()½ÈÀÌØí¸ôÄѼÌÜ츹ä¹ÕµÈ(}ÉÉå ÀÌØíÉ¥°Õ¥
Ñɱ
ÉÑ1° ÅÕ½ÐíQ¡¥Ì¥Ì±°ÅÕ½ÐìµÀìÀÌØí¸°ÄÀ°ÄÀ¬ ÌÀ¨ ÀÌØí¸´Ä¤¤°ÈÀÀ°ÈÀ¤¤)¹áÐ(ÀÌØíÉ¥lÁtôU    ½Õ¹ ÀÌØíÉ¥¤´ÄìÀÌØíÉ¥lÁtô½Õ¹Ð((ìQ¼ÉÑ¡´è)½ÈÀÌØí¸ôÄѼÀÌØíÉ¥lÁt($ì¼Ý¡ÑÙÈÝ¥Ñ Ñ¡½¹Ñɽ°%Ì¥¸ÀÌØíÉ¥lÀÌØí¹t¸¸¸)9áÐ

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
martin

An array is definitely the answer, just remember they are 0-based.

Whoops, yes thanks for pointing the error out PsaltyDS. I have edited my post to make the correction.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×