Sign in to follow this  
Followers 0
ondrovic

Checkboxes From An .ini File

3 posts in this topic

#1 ·  Posted (edited)

Trying to figure out the best way to automatically create checkboxes in a gui from a .ini file. I have looked at ListView but can't seem to get it to populate correctly. Here is the code that is reading the file

global $var = IniReadSection("C:\config.ini","install")
If @error Then
MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
For $i = 1 To $var[0][0]
If($var[$i][1] = 1) Then
MsgBox(4096,"",$var[$i][0] & @CRLF,3)
EndIf
Next
EndIf

It will grab each item in the ini and display the appropriate item in a msgbox any help would be greatly appreciated

Edited by ondrovic

Share this post


Link to post
Share on other sites



Example

Global $var = IniReadSection(@ScriptDir & '\Configuration.ini', "install")
If @error Then
MsgBox(4096, "", "Error occurred, probably no INI file.")
Else
If UBound($var) < 2 Then Exit -1
; For $i = 1 To $var[0][0]
;If ($var[$i][1] = 1) Then
; MsgBox(4096, "", $var[$i][0] & ' = ' & $var[$i][1])
;EndIf
; Next
EndIf

;Lets Create the GUI

GUICreate(@ScriptName & ' | Phoenix XL')
Local $sParam
For $i = 2 To $var[0][0]
$sParam &= $var[$i][1] & ','
Next
;Trim the Last Comma and Add Parenthesis
$sParam = '(' & StringTrimRight($sParam, 1) & ')'
;Lets Create the Element
Execute('GUICtrlCreate' & $var[1][1] & $sParam)
;Call is more appropriate but requires more code ;)


GUISetState()
While GUIGetMsg() <> -3
Sleep(10)
WEnd

#cs
Configuration.ini
[install]
El= CheckBox
Txt = "This is an Example"
1 =10
2 = 10
#ce

Thumbs up if it helped ;)

1 person likes this

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

Will give it a shot and report back thanks for the assist

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  
Followers 0