Jump to content

child error?


rawrr
 Share

Recommended Posts

So far this is my code..

#include <GUIConstants.au3>

$GUI = GUICreate("QLPS", 150, 180, -1, -1); this creates the Box and the title in the blue bar

$realm = GUICtrlCreateInput("texthere", 10, 90, 130, 20); Imput box (fool around with the numbers to change size)

$patch = GUICtrlCreateInput("texthere", 10, 140 , 130, 20)

$set = GUICtrlCreateButton("SET", 10, 50, 130, 25); The Button


GUISetState()
While 1
Switch GUIGetMsg()
Case - 3
Exit
Case $set

$set = _createchild()

$set = guictrlcreateinput("Name Here", 10, 140, 130, 20)



Func _CreateChild()
    Opt("TrayMenuMode",1)
    GUISetState(@SW_DISABLE,$GUI)
    $Child=GUICreate("Set",150,80,-1,-1,-1,-1,$GUI)
    $Namebox = GUICTRLCREATEINPUT("NAME", 10, 50, 130, 20)
    $save = GUICTRLCREATEBUTTON("SAVE", 45, 15, 60, 30)
    $save = traycreateitem (GUICTRLREAD ($namebox))
traycreateitem ()
    GUISetState()
    traysetstate() 
    
while 1
Switch GUIGetMsg()
Case - 3
Exit


    While 1
        $msg1 = GUIGetMsg()
        Switch $msg1
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
    GUIDelete($Child)
    GUISetState(@SW_ENABLE,$GUI)
   

    Return

Now I am trying to make it so when save (the save button) is clicked it makes a tray icon with the name that is in the input box (namebox) Idk if it right but I got this error, Posted Image

What do I do?

Link to comment
Share on other sites

  • Developers

This is the Tidy output which tells you about your problem(s):

#Tidy_Parameters=/rel 1
#include <GUIConstants.au3>
$GUI = GUICreate("QLPS", 150, 180, -1, -1); this creates the Box and the title in the blue bar
$realm = GUICtrlCreateInput("texthere", 10, 90, 130, 20); Imput box (fool around with the numbers to change size)
$patch = GUICtrlCreateInput("texthere", 10, 140, 130, 20)
$set = GUICtrlCreateButton("SET", 10, 50, 130, 25); The Button
GUISetState()
While 1
    Switch GUIGetMsg()
        Case - 3
            Exit
        Case $set
            $set = _CreateChild()
            $set = GUICtrlCreateInput("Name Here", 10, 140, 130, 20)
;### Tidy Error -> case Not closed before "Func" statement.
;### Tidy Error ->  "Func" cannot be inside any IF/Do/While/For/Case/Func statement.
            Func _CreateChild()
                Opt("TrayMenuMode", 1)
                GUISetState(@SW_DISABLE, $GUI)
                $Child = GUICreate("Set", 150, 80, -1, -1, -1, -1, $GUI)
                $Namebox = GUICtrlCreateInput("NAME", 10, 50, 130, 20)
                $save = GUICtrlCreateButton("SAVE", 45, 15, 60, 30)
                $save = TrayCreateItem(GUICtrlRead($Namebox))
                TrayCreateItem()
                GUISetState()
                TraySetState()
                While 1
                    Switch GUIGetMsg()
                        Case - 3
                            Exit
                            While 1
                                $msg1 = GUIGetMsg()
                                Switch $msg1
                                    Case $GUI_EVENT_CLOSE
                                        ExitLoop
                                EndSwitch
                            WEnd
                            GUIDelete($Child)
                            GUISetState(@SW_ENABLE, $GUI)
                            Return
Edited by Jos

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

  • Developers

;### Tidy Error ->  "Func" cannot be inside any IF/Do/While/For/Case/Func statement.

You cannot have a func...endfunc statement inside a loop or if and needs to be on its own.

Check the helpfile for examples.

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

  • Developers

Lol sorry, but I am so lost right now.. =[

Its your code so you should be know what you are doing.. right ?

How can anybody really help when you post a snippet that contains the error but we have no idea what it is that needs to be accomplished.

I explained the error you have and tidy - ed your code so you can see where your errors are in respect to the Func and the none closed While and Select statements.

Jos

Edited by Jos

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

I looked everything over I don't know what to fix..

#Tidy_Parameters=/rel 1
#include <GUIConstants.au3>
$GUI = GUICreate("QLPS", 150, 180, -1, -1); this creates the Box and the title in the blue bar
$realm = GUICtrlCreateInput("texthere", 10, 90, 130, 20); Imput box (fool around with the numbers to change size)
$patch = GUICtrlCreateInput("texthere", 10, 140, 130, 20)
$set = GUICtrlCreateButton("SET", 10, 50, 130, 25); The Button
GUISetState()
While 1
    Switch GUIGetMsg()
        Case - 3
            Exit
        Case $set
            $set = _CreateChild()
            $set = GUICtrlCreateInput("Name Here", 10, 140, 130, 20)
            ExitLoop
        EndSwitch
        WEnd
;### Tidy Error -> case Not closed before "Func" statement.
;### Tidy Error ->  "Func" cannot be inside any IF/Do/While/For/Case/Func statement.
            Func _CreateChild()
                Opt("TrayMenuMode", 1)
                GUISetState(@SW_DISABLE, $GUI)
                $Child = GUICreate("Set", 150, 80, -1, -1, -1, -1, $GUI)
                $Namebox = GUICtrlCreateInput("NAME", 10, 50, 130, 20)
                $save = GUICtrlCreateButton("SAVE", 45, 15, 60, 30)
                $save = TrayCreateItem(GUICtrlRead($Namebox))
                TrayCreateItem()
                GUISetState()
                TraySetState()
                endfunc
            
                While 1
                    Switch GUIGetMsg()
                        Case - 3
                            Exit
                            While 1
                                $msg1 = GUIGetMsg()
                                Switch $msg1
                                    Case $GUI_EVENT_CLOSE
                                        ExitLoop
                                EndSwitch
                            WEnd
                            GUIDelete($Child)
                            GUISetState(@SW_ENABLE, $GUI)
                            Return

my new one? still return error

Edited by rawrr
Link to comment
Share on other sites

rawwr

Your code have a many errors and difficult to read. You need this?:

#NoTrayIcon
#include <GUIConstants.au3>

Opt("TrayMenuMode", 1)

;Main GUI
$GUI = GUICreate("QLPS", 150, 180, -1, -1); this creates the Box and the title in the blue bar

$realm = GUICtrlCreateInput("texthere", 10, 90, 130, 20); Imput box (fool around with the numbers to change size)

$patch = GUICtrlCreateInput("texthere", 10, 140, 130, 20)

$set = GUICtrlCreateButton("SET", 10, 50, 130, 25); The Button

;Child GUI
$Child = GUICreate("Set", 150, 80, -1, -1, -1, -1, $GUI)

$Namebox = GUICtrlCreateInput("NAME", 10, 50, 130, 20)
    
$saveButton = GUICtrlCreateButton("SAVE", 45, 15, 60, 30)
    
$saveTray = TrayCreateItem(GUICtrlRead($Namebox))
    
TrayCreateItem("")

GUISetState(@SW_SHOW, $GUI)

While 1
    $msg = GUIGetMsg(1)
    
    Select
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $GUI
        ExitLoop
    Case ($msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $Child) Or ($msg[0] = $saveButton And $msg[1] = $Child)
        GUISetState(@SW_ENABLE, $GUI)
        GUISetState(@SW_HIDE, $Child)
        TraySetState(2)
    Case $msg[0] = $set
        GUISetState(@SW_DISABLE, $GUI)
        GUISetState(@SW_SHOW, $Child)
        TraySetState(1 + 4)
    EndSelect
WEnd
:)

P.S. Learn to write code a readability.

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