Jump to content

2 GUI's and am getting lost haha


 Share

Recommended Posts

Can you guys help me with this code

Click GUI1 and new windows will pop

Without doing anything else click Gui2 and second window will not pop unless button in in previously poped windows is pressed which will delete its own gui and exit the loop.

My question is this.

How (while in one of those 2 loops created by Radio's) read wather or not Main has switched, so that while 1st GUI is showing beign able to switch to second somehow.

Here is the simplest code i could come up with to demonstrate the problem.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("",300,100)
$Gui1Radio = GUICtrlCreateRadio ("Gui1",10,10)
$Gui2Radio = GUICtrlCreateRadio ("Gui21",10,30)
GUISetState(@SW_SHOW)

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
       Case $GUI_EVENT_CLOSE
           Exit
       Case $Gui1Radio
           $G1 = GUICreate ("Gui1",200,30)
           $Button1 = GUICtrlCreateButton ("Button 1",0,0)
           GUISetState(@SW_SHOW)
           While 1
              $G1msg = GUIGetMsg()
              Switch $G1msg
                Case $Button1
                    MsgBox(0,'','Button 1 pressed Exitloop')
                    GUIDelete ($G1)
                    ExitLoop
                EndSwitch
            WEnd
        Case $Gui2Radio
            $G2 = GUICreate ("Gui2",200,30)
           $Button2 = GUICtrlCreateButton ("Button 2",0,0)
           GUISetState(@SW_SHOW)
           While 1
              $G2msg = GUIGetMsg()
              Switch $G2msg
                Case $Button2
                    MsgBox(0,'','Button 2 pressed Exitloop')
                    GUIDelete ($G2)
                    ExitLoop
                EndSwitch
            WEnd
   EndSwitch
WEnd
Edited by madasraka
Link to comment
Share on other sites

You can not include a loop inside a loop. Try creating the new GUIs via calling a function.

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:

%programfiles%/AutoIt3/autoit3.chm
Link to comment
Share on other sites

  • Moderators

shanet,

You can not include a loop inside a loop

Please do not pass on incorrect information. Of course you can have loops inside loops. And there is no need to use functions here. :x

madasraka,

Take a look at the Managing Multiple GUIs tutorial in the Wiki - it shows you exactly how to do what you want to do by using the "Advanced" parameter with GUIGetMsg. :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

You can not include a loop inside a loop. Try creating the new GUIs via calling a function.

From your previous posts I see you are beginner so please stay out instead of making so many shit posts like this one.

I wonder if you only don't want to make bigger post count!   :x

Make posts only when you exactly know what are you talking about!!!

topic reported --> reason: post count hunter

Edited by Zedna
Link to comment
Share on other sites

yeah i know that, but it will not effect Linux, its commands or any environmental variables or anything else.

I wish autoit was actually coded their functions for linux specifically so that i could filemove or filecopy in linux as i can in windows but thats not true and i have little to no interested coding anything for linux caz it sucks anyway (after countless attempts of trying do do simple tasks as to backup/restore whole OS so i can restore it if i mess it up while learning, but that only works in windows)

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...