Jump to content

Little Loopproblem


Baku
 Share

Recommended Posts

Hi guys,

someone asked me to create a little tool. It should show the time of a country. It's actually easy, but i've got a little problem with the Gui-Idling loop. Look at this:

$countrycombo is a Combobox with Countries

$refbut is a button to refresh the time

While 1
    $msg = GuiGetMsg()
    $country = GuiCtrlRead($countrycombo)
    Select
    Case $country = "United Kingdom"
        GuiCtrlSetData($zeitlab, @HOUR - 1 & ":" & @MIN)
    Case $msg = $refbut
        GuiCtrlSetData($timelab, $time)
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Now, if i choose United Kingdom in the Combo it refreshs all the time and i cant exit the app. Thats actually what it SHOULDN'T do. It just should do the case one time. I already tried to add a Continueloop, but it didnt worked too.

So, someone got ideas :dance:? Yaya, i'm a damn noob, i kno :whistle:

Thanks in advance

Link to comment
Share on other sites

Check and compare the small changes:

While 1
    $msg = GuiGetMsg()
   ;;;;;; unnecessary line if you has $MSG --> $country = GuiCtrlRead($countrycombo)

    Select
    Case $msg = $countrycombo
         $sCountry = GUICtrlRead( $msg )
         If $sCountry = "United Kingdom" Then GuiCtrlSetData($zeitlab, @HOUR - 1 & ":" & @MIN)

    Case $msg = $refbut
        GuiCtrlSetData($timelab, $time)

    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop

    Case Else
   ;;;
    EndSelect
WEnd
Exit
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...