Jump to content

What am I doing wrong?


 Share

Recommended Posts

I created a GUI with the given code. Also I added some tabs to the GUI with some text on all tabs. However when I release GuiSetState() on the top, it doesn't show the text. I first need to navigate to another tab before it shows anything.

Can someone tell me what I am doing wrong? If I don't use GuiSetState(), I don't see the GUI.

Link to comment
Share on other sites

Here is the important part of the code:

GuiCreate ($title, 396, 396)

GuiSetIcon ("ico.ico", 0)

GuiSetState ()

GuiCtrlCreateTab (5, 5, 385, 385, $WS_EX_WINDOWEDGE)

GuiCtrlCreateTabItem (" " & $status & " ")

GuiCtrlCreateTabItem (" " & $information & " ")

GuiCtrlCreateGroup ("Test text", 8, 32, 376, 84)

$Label_1 = GuiCtrlCreateLabel("click me to run", 300, 300, 10, 10)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg= $Label_1

MsgBox (0, "test", "test")

Case Else

;;;

EndSelect

WEnd

While GuiGetMsg () <> $GUI_EVENT_CLOSE

WEnd

Link to comment
Share on other sites

i dont understand your problem, but try this:

#include <GUIConstants.au3>

$title = "hey"
GuiCreate ($title, 396, 396)
GuiSetIcon ("ico.ico", 0)
GuiSetState ()

GuiCtrlCreateTab (5, 5, 385, 385, $WS_EX_WINDOWEDGE)

GuiCtrlCreateTabItem (" " & "tab1" & " ")

GuiCtrlCreateTabItem (" " & "tab2" & " ")
GuiCtrlCreateGroup ("Test text", 8, 32, 376, 84)
$Label_1 = GuiCtrlCreateLabel("click me to run", 20, 50, 100, 20)

While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg= $Label_1
MsgBox (0, "test", "test")
EndSelect
WEnd
FootbaG
Link to comment
Share on other sites

im still unclear of what the problem is, when i ran the above script i provided everything worked fine, when i was on "tab1", nothing was in it, which is supposed to happen unless you tell it to put labels etc in it, then when i hit "tab2", i saw the Group control and the label in it, now if you could be a little mor specific, then i could help.. :)

FootbaG
Link to comment
Share on other sites

Sorry, I forgot an item:

GuiCreate ($title, 396, 396)

GuiSetIcon ("ico.ico", 0)

GuiSetState ()

GuiCtrlCreateTab (5, 5, 385, 385, $WS_EX_WINDOWEDGE)

GuiCtrlCreateTabItem (" " & $status & " ")

GuiCtrlCreateGroup ("Test text", 8, 32, 376, 84)

GuiCtrlCreateTabItem (" " & $information & " ")

GuiCtrlCreateGroup ("Test text", 8, 32, 376, 84)

$Label_1 = GuiCtrlCreateLabel("click me to run", 300, 300, 10, 10)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg= $Label_1

MsgBox (0, "test", "test")

Case Else

;;;

EndSelect

WEnd

While GuiGetMsg () <> $GUI_EVENT_CLOSE

WEnd

-------------------------------------------------

The bold code doesn't show up.

Link to comment
Share on other sites

Hello,

I have moved the GUISETSTATE just before the while to draw all components of the window :

GuiCreate ($title, 396, 396)
GuiSetIcon ("ico.ico", 0)

GuiCtrlCreateTab (5, 5, 385, 385, $WS_EX_WINDOWEDGE)
GuiCtrlCreateTabItem (" " & $status & " ")
GuiCtrlCreateGroup ("Test text", 8, 32, 376, 84)

GuiCtrlCreateTabItem (" " & $information & " ")

GuiCtrlCreateGroup ("Test text", 8, 32, 376, 84)
$Label_1 = GuiCtrlCreateLabel("click me to run", 300, 300, 10, 10)
GuiSetState ();<----------------- here
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg= $Label_1
MsgBox (0, "test", "test")
Case Else
;;;
EndSelect
WEnd

While GuiGetMsg () <> $GUI_EVENT_CLOSE
WEnd

So the group is drawn at th begining

Link to comment
Share on other sites

  • Developers

Thanks, that works. However you will need to press the "X" two times to close the program. Do you also know how to solve that?

<{POST_SNAPBACK}>

just remove the last 2 lines....

While GuiGetMsg () <> $GUI_EVENT_CLOSE
WEnd

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yes, You're right. I hvan't notice that.

Supress the 2 last lines :

While GuiGetMsg () <> $GUI_EVENT_CLOSE

WEnd

Because when your press the cross one time, you're leaving from the 1st loop; then the 2nd loop call GuigetMsg() a second Time. So you need to press the cross another time.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...