Jump to content

Why...?


notsure
 Share

Recommended Posts

Hello.

I'm trying to build a multiple form GUI. This is the code;

While 1
    $nMsg = GUIGetMsg(1)
    If @sec <> $sec then
      GUICtrlSetData($lbltime, @hour & ":" & @min & ":" & @SEC)
      $sec = @sec
   endif

    Select 
        Case $nMsg[0] = $cmdAdd And $nMsg[1] = $main
            AddFunc()
        ;$item1 = GUICtrlCreateListViewItem($time & "|" & $note & "|" & $prio, $listview1)

        Case $nMsg[0] = $GUI_EVENT_CLOSE And $nMsg[1] = $frmAdd
            guidelete($frmadd)
        Case $nMsg[0] = $GUI_EVENT_CLOSE And $nMsg[1] = $main
            Exit
        Case $nMsg[0] = $cmdCancel And $nMsg[1] = $frmAdd
            guidelete($frmadd)
    EndSelect

WEnd

If i start the code, the form dissapears without any error to the tray and is "pauzed". If I delete the 2 lines below:

Case $nMsg[0] = $cmdCancel And $nMsg[1] = $frmAdd
            guidelete($frmadd)

it actually works. Why does the GUI disappear when i insert those 2 lines? I cant find any logical explanation for this...

Link to comment
Share on other sites

Hello.

I'm trying to build a multiple form GUI. This is the code;

While 1
    $nMsg = GUIGetMsg(1)
    If @sec <> $sec then
      GUICtrlSetData($lbltime, @hour & ":" & @min & ":" & @SEC)
      $sec = @sec
   endif

    Select 
        Case $nMsg[0] = $cmdAdd And $nMsg[1] = $main
            AddFunc()
        ;$item1 = GUICtrlCreateListViewItem($time & "|" & $note & "|" & $prio, $listview1)

        Case $nMsg[0] = $GUI_EVENT_CLOSE And $nMsg[1] = $frmAdd
            guidelete($frmadd)
        Case $nMsg[0] = $GUI_EVENT_CLOSE And $nMsg[1] = $main
            Exit
        Case $nMsg[0] = $cmdCancel And $nMsg[1] = $frmAdd
            guidelete($frmadd)
    EndSelect

WEnd

If i start the code, the form dissapears without any error to the tray and is "pauzed". If I delete the 2 lines below:

Case $nMsg[0] = $cmdCancel And $nMsg[1] = $frmAdd
            guidelete($frmadd)

it actually works. Why does the GUI disappear when i insert those 2 lines? I cant find any logical explanation for this...

Can you pls post the full code.
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Link to comment
Share on other sites

  • 2 weeks later...

If i start the code, the form dissapears without any error to the tray and is "pauzed". If I delete the 2 lines below:

Case $nMsg[0] = $cmdCancel And $nMsg[1] = $frmAdd
            guidelete($frmadd)

it actually works. Why does the GUI disappear when i insert those 2 lines? I cant find any logical explanation for this...

Since you don't have the full code posted, so we can't test it I can only guess... but I'm thinking that it has something to do with you trying to control two GUIs at once. I don't know if that's really possible... I tried replicating your code (to an minimal) and I got a bad loop error for some reason, where it just kept creating a second GUI. Lucky it didn't crash my computer. I know you can control one, create another, and take control of that one, then switch back if you delete that one... but I'm not quite sure how to control two.

If you can live with not controling two GUIs at once, have the other GUI be a function in its self, and have this:

Case $GUI_EVENT_CLOSE
                GUIDelete()
                ExitLoop

that will delete the second GUI (most recently created) and exit the loop getting the $nMsg for it, and go back to your main GUI window.

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

using multiple GUIs i find it easier to use Onevent and @GUI_CTRLID and @GUI_WINHANDLE to get which window and control is being used

easier for me... but To eaches Own right?

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