Sign in to follow this  
Followers 0
eagle51

Can't find the error :(

6 posts in this topic

Hello,

hope you guys can help me :)

Here is the code...

$ParentWin = GUICreate ("Bitte treffen Sie Ihre Auswahl", $gWidth, $gHeight)
$ParentWin_Pos = WinGetPos($ParentWin, "")


; **** Erstellen von Menüs, Buttons etc.****
$m_men1 = GuiCtrlCreateMenu ("Funktionenen")
$m_men2 = GuiCtrlCreateMenu ("?")
    
$m_men1_pataufn = GuiCtrlCreateMenuitem ("Create",$m_men1)
$m_men1_patstor = GuiCtrlCreateMenuitem ("Selete",$m_men1)
$m_men1_line = GuiCtrlCreateMenuitem ("",$m_men1)
$m_men1_beenden = GuiCtrlCreateMenuitem ("Close",$m_men1)

$m_men2_hotkeys = GuiCtrlCreateMenuitem ("Hotkeys",$m_men2)
$m_men2_hinweise = GuiCtrlCreateMenuitem ("Info",$m_men2)
$m_men2_line = GuiCtrlCreateMenuitem ("",$m_men2)
$m_men2_info = GuiCtrlCreateMenuitem ("?",$m_men2)

GUICtrlCreateGroup ("Please choose an option...", 15, 10, 270, 120)

$b_pataufn = GUICtrlCreateButton ("create", 25, 35, 250, 20)
$b_patstor = GUICtrlCreateButton ("delete", 25, 60, 250, 20)
$b_exit = GUICtrlCreateButton ("Beenden", 25, 100, 250, 20)


GUISwitch($ParentWin)
GUISetState ()


    While 1
        $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE or $msg = $m_men1_beenden or $msg = $b_exit Then
                        GUIDelete()
                        Exit
            EndIf
            
            If $msg = $m_men1_patstor or $msg = $b_patstor Then     
                $ChildWin = GUICreate("delete", 275, 130, $ParentWin_Pos[0] + 50, $ParentWin_Pos[1] + 50)
                                        GUICtrlCreateLabel("Please enter a number (-1 for all).", 5, 10, 300, 50)
                        $stor_anzahl =GuiCtrlCreateInput("",5,70,200,20)
                        $b_s_ok =GUICtrlCreateButton("Ok", 5, 100, 70, 20)
                        $b_s_abr =GUICtrlCreateButton("Abbrechen", 90, 100, 70, 20)
                                                                                                                             GUISetState(@SW_SHOW)
                            If GUIGetMsg() = $b_s_ok Then
                                If $stor_anzahl = 1 Then
                                                                                                                                 ; code......
                                                                                                                                Endif
                                If $stor_anzahl = "-1" Then
                                ;code....
                                Endif

What the script does:

In the begining I create the main window where the user will be asked what he wants to do.

If he click on "delete" a new window will op up (child) and the user will be asked to enter a number in an inputbox.

Then he have to click on okey and the program should do the code If... =1 ... If = 2... and so on.

In the main menu all buttons etc. are working.

But if the child-window is active and the user click on "abbrechen" or "ok" nothing happens.

can someone help me please to find the error?

Thanks,

eagle51

Share this post


Link to post
Share on other sites



Look at this line of code:

If $stor_anzahl = 1 ThenoÝ÷ Ù©©²Ú+j|ÚX¬herí®g¢Ö§ºfÞ­*2¢é®²ÚÞiØ­¶¶+wöËÚç¥G­+ºÚ"µÍYÕRPÝXY
    ÌÍÜÝÜØ[Z
HHH[

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Look at this line of code:

If $stor_anzahl = 1 ThenoÝ÷ Ù©©²Ú+j|ÚX¬herí®g¢Ö§ºfÞ­*2¢é®²ÚÞiØ­¶¶+wöËÚç¥G­+ºÚ"µÍYÕRPÝXY
    ÌÍÜÝÜØ[Z
HHH[oÝ÷ Ûú®¢×zYhjwm©ä±ú+éixºØ­²)ev¬mÂäN¡×¢²z0jëh×6
                    $stor_anzahl =GuiCtrlCreateInput("",5,70,200,20)
                        $b_s_ok =GUICtrlCreateButton("Ok", 5, 100, 70, 20)
                        $b_s_abr =GUICtrlCreateButton("Abbrechen", 90, 100, 70, 20) 
                            GUISetState(@SW_SHOW)
                            GUISwitch($ChildWin)
                            If GUIGetMsg() = $b_s_ok Then
                                If GUICtrlRead($stor_anzahl) = 1 Then

the other part is equal.

But nothing happens if I click on the "ok" button.

Bye bye

eagle51

Edited by eagle51

Share this post


Link to post
Share on other sites

If GUIGetMsg() = $b_s_ok Then

Change the line above to If $msg = $b_s_ok Then ...

Share this post


Link to post
Share on other sites

Hello and thanks for helping,

but it sill doesn't work :)

The code is now:

$stor_anzahl =GuiCtrlCreateInput("",5,70,200,20)
                        $b_s_ok =GUICtrlCreateButton("Ok", 5, 100, 70, 20)
                        $b_s_abr =GUICtrlCreateButton("Abbrechen", 90, 100, 70, 20) 
                            GUISetState(@SW_SHOW)
                            GUISwitch($ChildWin)
                            If GUIGetMsg() = $b_s_ok Then
                                If GUICtrlRead($stor_anzahl) = 1 Then   
oÝ÷ ÚØ^¢Ø^®«¶+ªæ¥ëg¢ØbZ¦§²'ÈrXíꮢÚ$ªê-nëm¢pry¼y¨%{ªê-xéåÉÊ'qêmjëh×6
  $stor_anzahl =GuiCtrlCreateInput("",5,70,200,20)
                        $b_s_ok =GUICtrlCreateButton("Ok", 5, 100, 70, 20)
                        $b_s_abr =GUICtrlCreateButton("Abbrechen", 90, 100, 70, 20) 
                            GUISetState(@SW_SHOW)
                            GUISwitch($ChildWin)
                            If GUIGetMsg() = $b_s_ok Then
                                If GUICtrlRead($stor_anzahl) = 1 Then   
   While 1
        $msg = GUIGetMsg()
            If $msg = $GUI_EVENT_CLOSE or $msg = $b_s_ok  Then
                  If GUICtrlRead($stor_anzahl) = 1 Then   ...
                  GUIDelete()
            EndIf
  WEnd

Or you can use GUIGetMsg(1) ; advanced - see HelpFile

Share this post


Link to post
Share on other sites

why not use switch and case instead of your if-sentences?

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