Jump to content
Sign in to follow this  
Tagor

What am I doing wrong?

Recommended Posts

Tagor

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.

Share this post


Link to post
Share on other sites
layer

we would be able to help if you supplied some code :)


FootbaG

Share this post


Link to post
Share on other sites
Tagor

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

Share this post


Link to post
Share on other sites
layer

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

Share this post


Link to post
Share on other sites
Tagor

The problem is that it only shows the first tab of "GuiCtrlCreateTabItem".

Share this post


Link to post
Share on other sites
layer

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

Share this post


Link to post
Share on other sites
Tagor

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.

Share this post


Link to post
Share on other sites
sylvanie

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


Share this post


Link to post
Share on other sites
Tagor

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?

Share this post


Link to post
Share on other sites
Jos

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
sylvanie

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.


Share this post


Link to post
Share on other sites
sylvanie

Sorry JDeb,

I was writing my post, when you've posted yours ;-)


Share this post


Link to post
Share on other sites
Tagor

Ah, thanks, I see!

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  

×