Bubnoff Posted November 3, 2006 Posted November 3, 2006 Would like to use inireadsectionnames Works, but at a cost. Now if I edit the .ini I have to edit the list to make the other functions coincide with each other. Viva Autoit ............................ Bubnoff [quote] Use educated speculation to create the illusion of pleasure ...Its the closest you'll ever get.- Anon [/quote]
stampy Posted November 3, 2006 Posted November 3, 2006 So I'm not quite sure is this kinda what your looking for ? #include <GUIConstants.au3> GUICreate("My GUI list") ; will create a dialog box that when displayed is centered $var = IniReadSectionNames(@WindowsDir & "\win.ini") $mylist=GUICtrlCreateList ("", 176,32,121,97) for $i = 1 to UBound($var)-1 GUICtrlSetData($mylist,$var[$i]) Next $close=GUICtrlCreateButton ("my closing button", 64,160,175,25) GUISetState () $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Wend
Cue Posted November 4, 2006 Posted November 4, 2006 @Stampy you do not need to use ubound(var)-1 since $var[0] stores this value. Just thought I'll point that out for future ref
Valik Posted November 4, 2006 Posted November 4, 2006 @Stampy you do not need to use ubound(var)-1 since $var[0] stores this value. Just thought I'll point that out for future ref That's a very bad thing to point out, however. It's better to always use UBound(). Not all array's contain their length in element 0. I guarantee you will try to use element 0 to get the length of an array which does not store it's length there if you get in the habit of using element 0.
Paulie Posted November 4, 2006 Posted November 4, 2006 (edited) That's a very bad thing to point out, however. It's better to always use UBound(). Not all array's contain their length in element 0. I guarantee you will try to use element 0 to get the length of an array which does not store it's length there if you get in the habit of using element 0.I wouldn't go so far as to call it a "very bad thing to point out" because personally, I find that rather useful, sure the scenario you mention has happened to me several times, but it is easy to fix; I've simply gotten into the habit of checking for the particular function in the helpfile to see if it returns the number of values in the array.It's probably better to just use UBound(), but for convenience reasons, If certain functions count the array for me, there is really no sense in me doing it again...right? Edited November 4, 2006 by Paulie
Bubnoff Posted November 4, 2006 Author Posted November 4, 2006 (edited) It works ......of course. Thanks Stampy!!!! And thanks to Valik, Paulie and Cue for clarifying Ubound, the use of which I've never fully grasped. This should make the main part of this project topple like dominoes.Bubnoffedit : I'm somewhat embarrassed to point this out as it makes me look bad/lazy, however....There is a great example of this in the help file that I somehow overlooked... I'm in the process of makinga more thorough examination of .chm as a result. Thanks for your patience. Edited November 4, 2006 by Bubnoff [quote] Use educated speculation to create the illusion of pleasure ...Its the closest you'll ever get.- Anon [/quote]
Cue Posted November 5, 2006 Posted November 5, 2006 A good point Valik, will be more carefull and try not make it a habit but i ,like paulie, usually check the helpfile anyway . In this scenario seeing as IniReadSectionNames() has already stored the value in element 0 i thought it will be better to use it than call a function to return the value again.
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