Sign in to follow this  
Followers 0
Champak

My guisetstate hide/show is not working

14 posts in this topic

#1 ·  Posted (edited)

The hiding and the showing of the guisetstate is not working as it should....or as I think it should. Can someone tell me what is wrong?

$ChildUpdateCheck = GUICreate($Title & " - Update Check", 566, 500, IniRead($Where, "Position", "X-Pos", 0) + 50, IniRead($Where, "Position", "Y-Pos", 0) + 100)

$oIE = ObjCreate("Shell.Explorer.2")    

Func UpdateCheck()
;Local $labelC1
;Local $labelC2
;Local $labelUpdate
;Local $labelFixC

    $labelC1 = GUICtrlCreateLabel("Internet connection successful.", 10, 2, 280, 20)
    GUICtrlSetState ( $labelC1, $GUI_HIDE ) 
    $labelC2 = GUICtrlCreateLabel("Unable to connect to the internet.", 10, 2, 500, 20)
    GUICtrlSetState ( $labelC2, $GUI_HIDE )
    $labelUpdate = GUICtrlCreateLabel("ONLY if site is not active, you can check for updates through nam@execs.com.", 405, 435, 140, 40)
    GUICtrlSetState ( $labelUpdate, $GUI_HIDE )

Ping("www.google.com")
If @error = 0 Or  @error = 1 Then
    GUICtrlSetState ( $labelC1, $GUI_SHOW )
    GUICtrlSetColor( $labelC1,0x11B600)
    GUICtrlSetFont( $labelC1, 12, 800, "", $font2)

Else
    GUICtrlSetState ( $labelC2, $GUI_SHOW )
    GUICtrlSetColor($labelC2,0xff0000)
    GUICtrlSetFont( $labelC2, 12, 800, "", $font2)

    GUICtrlSetState ( $labelUpdate, $GUI_SHOW )
    GUICtrlSetColor( $labelUpdate,0xff0000)
EndIf
$GUIActiveX         = GUICtrlCreateObj      ( $oIE,      10, 25 , 546 , 400 )
;$oIE.navigate("http://www.esnips.com/web/Champak")
$oIE.navigate("http://www.google.com")
EndFunc

$labelUpdate = GUICtrlCreateLabel("N.A.M. Update Checker.", 100, 445, 298, 35)
GUICtrlSetFont(-1, 18, 800, "", $font1)

$CheckUpdate = GUICtrlCreateButton("Check", 10, 430, 80, 20) ;Check
GUICtrlSetBkColor(-1, $BGColor)

$CloseUpdate = GUICtrlCreateButton("Close", 10, 455, 80, 20) ;Close
GUICtrlSetBkColor(-1, $BGColor)

GUISetState(@SW_HIDE)

Also

I would prefer this to be able to actually scan the page for "NAM vXX" and check back with the ini file to see if the "XX" is higher than what is in the ini. And if it is, indicate "update is available".

Thanks

Edited by Champak

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Did you #include <guiconstants.au3> ? Or you could probaby just do @SW_HIDE and @SW_SHOW.

like this

GUICtrlSetState ( $labelC1, @SW_HIDE )
Edited by bucky002

Share this post


Link to post
Share on other sites

Yes that include is there. and that show and hide is for windows not guis......but what the hell, I tried anyway and it is a no go. Any other ideas, and also the other thing I want to do.

Thanks.

Share this post


Link to post
Share on other sites

Hmm, I don't know why it won't hide, can I see full code? Also, @SW_HIDE is used for everything not just windows. You will need to use

InetGet

FileReadLine

A string command, probably StringRegExp. :D

Then you will need to compare what you returned from the string command to what is in your ini.

Eh, I think that's it. I might be able to help you with hiding it and showing it if you put up the full code.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Whoa, I just noticed it was GUICtrlSetState I thought you were talking about GUISetState.

If it's a Label you probably can't hide it. You can change it to nothing though using GUICtrlSetData.

That's one looooong code.

EDIT: Added some more

Edited by bucky002

Share this post


Link to post
Share on other sites

Whoa, I just noticed it was GUICtrlSetState I thought you were talking about GUISetState.

If it's a Label you probably can't hide it. You can change it to nothing though using GUICtrlSetData.

That's one looooong code.

EDIT: Added some more

A control can be hidden with GuiCtrlSetState():

$Label_1 = GuiCtrlCreateLabel("Test Label One.", 10, 10)
GuiCtrlSetState($Label_1, @GUI_HIDE)

:D


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

that is what I did. It is just not working.

Share this post


Link to post
Share on other sites

that is what I did. It is just not working.

Is the problem only with the ones that overlap, like $LabelC1 and $LabelC2? Other than that, nothing looks strange in it. Maybe instead of having them appear/disappear in the same location you could put them in seperate locations and enable/disable as required? Not a fix, I know, but maybe a workaround for now... :D


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

#10 ·  Posted (edited)

OK, I solved my problem, I just made everything overlap each other equally so they totally disapear from view...even though for whatever reason they are not actually disappearing with the gui_hide/show function. As far as I'm concerned I'm satisfied because what I technically want to happen is happening, but I would still like to know why this isn't working in the first place if anyone knows.

Also, why the controlid is only changing on the child gui and not on the main. One of my thoughts was to use controlshow/hide with this, because I am using it on the main gui with other stuff, but ONLY with this particular child gui page the commandids are always changing. Are controlids only guaranteed to stay constant on the main gui?

bucky002, I'm not getting how you are saying to fix my other problem:

InetGet

FileReadLine

A string command, probably StringRegExp. :D

Then you will need to compare what you returned from the string command to what is in your ini.

Isn't the InetGet for downloading files? I need to read the page that appears in my child gui for what I'm looking for.

Thanks.

Edit: I think it should be noted in the helpfile that if you are using controlcommand, and you add a gui control before gui control's you alread had mapped out, those previous gui control IDs will change do to the insertion of the new ones.

Edited by Champak

Share this post


Link to post
Share on other sites

Edit: I think it should be noted in the helpfile that if you are using controlcommand, and you add a gui control before gui control's you alread had mapped out, those previous gui control IDs will change do to the insertion of the new ones.

Say what? :wacko:

You are saying you added a control to a GUI and that changed the Control IDs of previously created controls? Can you post a code snippet to demonstrate that? :D


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

#12 ·  Posted (edited)

Isn't the InetGet for downloading files? I need to read the page that appears in my child gui for what I'm looking for.

Thanks.

You can use it to download the HTML code of the page. Just save it as a txt or dat file. The name of it is in there somewhere, for me it was on line 571. It should look like this.

<a class="CommandLink" href='/doc/a4e92452-21c3-45df-8e38-e84b81d989f4/NAM-v1.0.rar'><strong>NAM v1.0.rar</strong></a>

Edited by bucky002

Share this post


Link to post
Share on other sites

PsaltyDS, just grab any of the gui examples in the autoit folder, look at the control ID, then add a checkbox or something before and existing checkbox and look at what the control ID of the previous one you looked at is now. You'll see that the original ones increased.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

I didn't include the download portion yet, just testing the main stuff. This is what I have so far, but it isn't working. Why? Also, how do I get the ">" to read decimal points? It doesn't seem to see 2.X, just whole numbers.

$VersionCheck = IniRead("NAM.ini", "Version", "NAMV", "no")
$file = "testfile.txt"

$Result = StringRegExp(FileRead($file, 1), '([:digit:]{1,4})(?:.rar)', 1)
                               
                               
If $VersionCheck > $Result Then
MsgBox(0, "Tester1", $Result[0])
 Else
MsgBox(0, "Tester2", "no")
EndIf

Thanks.

Edited by Champak

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