window problem

Just starting out? Need help? Post your questions and find answers here.
wh1sp3r
User
User
Posts: 11
Joined: Mon Apr 17, 2006 9:08 pm

window problem

Post by wh1sp3r »

I have problem with new window. So, i open my window, where are values from pressure sensors, all works ok but when I move with window or I move cursor on close button, window freeze, windows show "program not responding". Why ? Have I missed something importat ? I call WindowEvent() every loop and have delay(1) there.

my code:

Code: Select all

      OpenWindow(#staticmeasure, 219, 349, 943, 160, "Statické měření",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered ,WindowID(#Window_0))
      CreateGadgetList(WindowID(#staticmeasure))
      TextGadget(#static_text4, 730, 0, 60, 55, "4:")
      SetGadgetFont(#static_text4, FontID1static)
      TextGadget(#static_text1, 10, 0, 60, 55, "1:")
      SetGadgetFont(#static_text1, FontID1static)
      TextGadget(#static_text2, 245, 0, 60, 55, "2:")
      SetGadgetFont(#static_text2, FontID1static)
      TextGadget(#static_text3, 485, 0, 60, 55, "3:")
      SetGadgetFont(#static_text3, FontID1static)
      TextGadget(#staticvalue1, 10, 60, 195, 90, "10.00")
      SetGadgetFont(#staticvalue1, FontID3static)
      TextGadget(#staticvalue2, 250, 55, 195, 90, "10.00")
      SetGadgetFont(#staticvalue2, FontID3static)
      TextGadget(#staticvalue3, 490, 50, 195, 90, "10.00")
      SetGadgetFont(#staticvalue3, FontID3static)
      TextGadget(#staticvalue4, 735, 50, 195, 90, "10.00")
      SetGadgetFont(#staticvalue4, FontID3static)
      
      
       kontrola = Kontrola_pripojeni()
       If kontrola = 1
      
      WriteSerialPortString(#SerialPort, "#")
      
      oldtime = ElapsedMilliseconds()
      Repeat    
         Measure_winID = WindowEvent()
         getSERIALdata()
                  
         time = ElapsedMilliseconds()
         If (oldtime + 300) < time 
         Debug "data" "
         SetGadgetText(#staticvalue1, StrF(DATAA1/100.0,2))
         SetGadgetText(#staticvalue2, StrF(DATAC1/100.0,2))
         SetGadgetText(#staticvalue3, StrF(DATAD1/100.0,2))
         SetGadgetText(#staticvalue4, StrF(DATAE1/100.0,2))
         
         
         oldtime = time
         EndIf
         delay(1)
      Until Measure_winID = #PB_Event_CloseWindow   
User avatar
idle
Always Here
Always Here
Posts: 6014
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Post by idle »

I suspect your call to getserialdata() is not finishing.
it probably should be in thread.
wh1sp3r
User
User
Posts: 11
Joined: Mon Apr 17, 2006 9:08 pm

Post by wh1sp3r »

yeah, you are right. In this function, I am waiting for data every loop, Its strange, because, its only 10 ms to get data ..
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

how would you know it only takes 10 secs?
seems it doesn't.

... why and how is impossible to say without the code of the procedure.
oh... and have a nice day.
Post Reply