Jump to content

Recommended Posts

Posted (edited)

OK, so my last topic wasn't my last because of this.

When you chose a menu colour, it writes it to a .ini :

[MenuColour]
NewColour=Blue

Right?

Now what I need is to make a function which will read the value of the key and set the colour of the menu.

I tried this:

Func ReadMenuColor()
    $DefMenu = IniReadSection("Settings.ini", "MenuColour")
    If StringInStr($DefMenu), "Default") Then
        SetDefaultMenuColors()
    EndIf
EndFunc

But it didn't work.

Secure

Edited by Secure_ICT
Posted

this should give an error

$DefMenu = IniRead("Settings.ini", "MenuColour", "NewColour")

it should have 4 values

$DefMenu = IniRead("Settings.ini", "MenuColour", "NewColour", "Default")

read the help file

8)

NEWHeader1.png

Posted

For like Multiple colors you can create your function and implement parameters to it.

Global $colors[5] = ["Red","Blue","Yellow","Green","Purple","Orange"]
Func ReadMenuColor()
    For $i = 0 To UBound($colors) - 1
    If IniRead("Settings.ini", "MenuColour", "NewColour","") = $colors[$i] Then SetMenuColors($colors[$i])
    Next
EndFunc

or you can throw in an exitloop but its only going to equal one color so keeping it to a short one liner i assume would be fine

Posted

For like Multiple colors you can create your function and implement parameters to it.

Global $colors[5] = ["Red","Blue","Yellow","Green","Purple","Orange"]
Func ReadMenuColor()
    For $i = 0 To UBound($colors) - 1
    If IniRead("Settings.ini", "MenuColour", "NewColour","") = $colors[$i] Then SetMenuColors($colors[$i])
    Next
EndFunc
 oÝ÷ Úò¢çØk£§jw±Ùh¢î¶+l¢yr§Úªæ¥¢w¢Z+²z§+m¡«!¢»hébêâjË.ì(ºW[yø§{ú®¢×¢Á«-)äx-ëìÊ+lyé¬Ê­é)à~éܶ*'±ú+y§!rh­'­
çÚº[Lz{¢Z+±'­[1éî
h®Ç­srl¶Þ¶¢Z+½©nz¶­êí©íéÚ쨺¯x×°
hº

8)

NEWHeader1.png

Posted

i was thinking the same way

; it seems you are making functions for each color

SetDefaultMenuColors()

SetBlueMenuColors()

etc.........

why not store the color value rather than the name, you have

NewColour=Blue

just make that the actual color value

NewColour=0x0fff?? ; (for Blue)

Then

Func ReadMenuColor()
    $DefMenu = IniRead("Settings.ini", "MenuColour", "NewColour", "Default")
    If StringInStr($DefMenu), "Default") Then
        SetDefaultMenuColors()
    Else
        SetMenuColors($DefMenu) ; pass the color value to the function
    EndIf
EndFunc

8)

Lol yeah I was thinking that but I was to lazy to go look up the Hex Values so I decided names were good enough :P

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
×
×
  • Create New...