Sign in to follow this  
Followers 0
GodForsakenSoul

Selected parts of GUI only plz

5 posts in this topic

i would like to have the GUI check what kind of pictures or labels it needs to display depending on the situation.

the situation is being dictated by a rather complicated INI file, but (with the help of comments) i can understand it.

here's an example of what i would like to do. as in, i would like this to work

$iniread=iniread("myini.ini","test","test1","0") ;let's assume test1=1 when everything's good
guicreate("example gui",350,300)
opt($GCM,0) ;i shortened "GuiCoordMode", among other things, to $GCM in a special custom made constants file i made. i find it easier this way.
if $iniread=1 then
   guictrlcreatelabel("This is the "correct" label",25,25,300,20)
else
   guictrlcreatelabel("This is the "wrong" label",25,25,300,20)
endif

i understand that i'm, of course, missing some vital code to actually SHOW the gui, but i believe this is the important bit.

despite all of my efforts, the "wrong" label (more then just label actually) is the thing that shows up, disregarding the fact that $iniread at that given situation is 1. while i CAN make an ugly function to act as a switch and build two guis, i would like to avoid it, generally.

i hope i've been clear with explaining my problem.

best regards

GFS

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

IniRead returns a string not a number. I think you need

If Number($iniread) = 1 then

EDIT: Sorry, ignore that, "1" does equate to 1, obvious now but not when I posted for some reason.

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

I used your code as follows:

$iniread=iniread("myini.ini","test","test1","0") ;let's assume test1=1 when everything's good
guicreate("example gui",350,300)
opt('GuiCoordMode',0) ;i shortened "GuiCoordMode", among other things, to $GCM in a special custom made constants file i made. i find it easier this way.
if $iniread=1 then
   guictrlcreatelabel("This is the correct label",25,25,300,20)
else
   guictrlcreatelabel("This is the wrong label",25,25,300,20)
endif

GUISetState()

Sleep (3000)

I was sure that myini.ini file is located next to .au3 script file.

Maybe your problem is the location of the .ini file as the above is working successfully.

Share this post


Link to post
Share on other sites

I see. Well, from this i learn only one thing: God hates me.

I have no idea where i could have messed up.

The ini is located in "\Data\", but i made sure that i hit it each time at least 20 times. Perhaps more.

I made msgbox's to show the content of the $iniread...

I DID EVERYTHING CONCIEVABLE TO DETECT THE ERROR!

yet i failed.

I hear hell is warm.

Share this post


Link to post
Share on other sites

Perhaps put the ini file in the same location as your script, then change

$iniread=iniread("myini.ini","test","test1","0")

to

$iniread=iniread(@ScriptDir&"\myini.ini","test","test1","0")


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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