Sign in to follow this  
Followers 0
rawrr

child error?

13 posts in this topic

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?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

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

#3 ·  Posted (edited)

Thanks, but I still don't understand?

I am still for the most part new.

Edited by rawrr

Share this post


Link to post
Share on other sites

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


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

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

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

#7 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Bump? I still need help. =[

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Thanks. I was never neat. But I did get the return error out! =]

Share this post


Link to post
Share on other sites

But I did get the return error out! =]

What? Where? :)

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