Page 1 of 1

The window is building slow, why ?

Posted: Wed Jan 11, 2012 3:37 pm
by sverrips
Enumeration
#Window_0
#Button_0
#Text_0
#Text_1
#String_0
#String_1
#Text_2
#Text_3
#String_2
#String_3
#Text_4
#Text_5
#String_4
#Text_6
#Text_7
#Text_8
#Text_9
#Text_10
#Text_13
#Text_14
#Text_15
#String_5
#String_6
#String_7
#String_8
#String_9
#String_10
#String_11
#String_12
#String_13
#Text_16
#Text_17
#String_14
#String_15
#Frame3D_0
#Frame3D_1
#Text_18
#Text_19
#Text_20
#Text_21
#Text_22
#ExplorerTree_0
#Text_23
#ExplorerTree_1
#Radio_0
#Radio_1
#Text_24
#Text_25
#Text_26
#Text_27
#Radio_2
#Radio_3
#Text_28
#String_18
#String_19
#String_20
#String_21
EndEnumeration


If OpenWindow(#Window_0, 253, 24, 950, 889, "Laura Webb", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
ButtonGadget(#Button_0, 830, 850, 90, 30, "Close")
TextGadget(#Text_0, 130, 60, 310, 20, "LFR (setting for left switch fixed ratio [any number from 1 to 100]) ")
TextGadget(#Text_1, 130, 90, 320, 20, "RFR (setting for right switch fixed ratio [any number from 1 to 100)])")

StringGadget(#String_0, 40, 60, 70, 20, "", #PB_String_Numeric)
StringGadget(#String_1, 40, 90, 70, 20, "", #PB_String_Numeric)

TextGadget(#Text_2, 130, 120, 280, 20, "DOLC (setting for duration of the opening of the left chute)")
TextGadget(#Text_3, 130, 150, 290, 20, "DORC (setting for duration of the opening of the right chute)")
StringGadget(#String_2, 40, 120, 70, 20, "", #PB_String_Numeric)
StringGadget(#String_3, 40, 150, 70, 20, "", #PB_String_Numeric)
TextGadget(#Text_4, 130, 180, 460, 20, "IRI (inter-response interval that leads to the ending of the setting (N/A, or any number of minutes)")
TextGadget(#Text_5, 130, 210, 470, 20, "TMD (total maximum duration of test that leads to the ending of the setting [any number of minutes]) ")
StringGadget(#String_4, 40, 180, 70, 20, "", #PB_String_Numeric)
TextGadget(#Text_6, 130, 240, 200, 20, "TOFL (type of feed related to left switch)")
TextGadget(#Text_7, 130, 270, 260, 20, "TOFR (type of feed related to right switch)")
TextGadget(#Text_8, 130, 300, 70, 20, "CID (calf ID)")
TextGadget(#Text_9, 830, 710, 40, 20, "Date")
TextGadget(#Text_10, 830, 740, 30, 20, "Time")
TextGadget(#Text_13, 130, 330, 110, 20, "SN (session number)")
TextGadget(#Text_14, 130, 360, 200, 20, "TOS (type of session [training or testing])")
TextGadget(#Text_15, 130, 390, 100, 20, "Comments (any text)")
StringGadget(#String_5, 40, 210, 70, 20, "", #PB_String_Numeric)
StringGadget(#String_6, 40, 240, 70, 20, "")
StringGadget(#String_7, 40, 270, 70, 20, "")
StringGadget(#String_8, 40, 300, 70, 20, "")
StringGadget(#String_9, 740, 710, 70, 20, "")
StringGadget(#String_10, 740, 740, 70, 20, "")
StringGadget(#String_11, 40, 330, 70, 20, "", #PB_String_Numeric)
StringGadget(#String_12, 40, 360, 70, 20, "")
StringGadget(#String_13, 40, 420, 520, 130, "")
TextGadget(#Text_16, 130, 570, 650, 20, "DAL (duration accorded to calf for the consumption of the reward [any number of seconds] [consumption time] for the left (CTL) switches)")
TextGadget(#Text_17, 130, 610, 660, 20, "DAR (duration accorded to calf for the consumption of the reward [any number of seconds] [consumption time] for the right (CTR) switches)")
StringGadget(#String_14, 40, 570, 70, 20, "", #PB_String_Numeric)
StringGadget(#String_15, 40, 610, 70, 20, "", #PB_String_Numeric)
Frame3DGadget(#Frame3D_0, 20, 30, 910, 620, "Settings")
Frame3DGadget(#Frame3D_1, 20, 680, 900, 160, "Realtime")
TextGadget(#Text_18, 130, 710, 200, 20, "Count successful presses to the switches")
TextGadget(#Text_19, 130, 740, 140, 20, "Counting consumption time")
TextGadget(#Text_20, 130, 770, 150, 20, "Count rewards per switch (left)")
TextGadget(#Text_21, 130, 800, 160, 20, "Count rewards per switch (Right)")
TextGadget(#Text_22, 650, 60, 210, 20, "Play a sound for each successful press")
ExplorerTreeGadget(#ExplorerTree_0, 650, 90, 260, 200, "")
TextGadget(#Text_23, 650, 320, 170, 20, "Play a sound for delivery of reward")
ExplorerTreeGadget(#ExplorerTree_1, 650, 350, 260, 200, "")
OptionGadget(#Radio_0, 360, 710, 20, 20, "")
OptionGadget(#Radio_1, 360, 740, 20, 20, "")
TextGadget(#Text_24, 390, 710, 40, 20, "Lamp 1")
TextGadget(#Text_25, 390, 740, 40, 20, "Lamp 2")
TextGadget(#Text_26, 500, 710, 200, 20, "Play a sound for each successful press")
TextGadget(#Text_27, 500, 740, 170, 20, "Play a sound for delivery of reward")
OptionGadget(#Radio_2, 470, 710, 20, 20, "")
OptionGadget(#Radio_3, 470, 740, 20, 20, "")
TextGadget(#Text_28, 20, 850, 370, 20, "2012 - Software created by Tupola, Wageningen-UR, version 20120106-001")
StringGadget(#String_18, 40, 710, 70, 20, "")
StringGadget(#String_19, 40, 740, 70, 20, "")
StringGadget(#String_20, 40, 770, 70, 20, "")
StringGadget(#String_21, 40, 800, 70, 20, "")
SetGadgetState(#Radio_0, #PB_Checkbox_Checked)

Repeat
Delay(100)
EventID=WindowEvent()
Until EventID=#PB_Event_CloseWindow
CloseWindow(#Window_0)
EndIf
End

Re: The window is building slow, why ?

Posted: Wed Jan 11, 2012 3:39 pm
by nco2k
remove Delay(100) and use WaitWindowEvent() instead of WindowEvent().

c ya,
nco2k

Re: The window is building slow, why ?

Posted: Wed Jan 11, 2012 4:12 pm
by sverrips
Hello,

That's the problem... WaitWindowsEvent. The follow to do is make a loop with measure data. It's need to looping.

Stephan

Re: The window is building slow, why ?

Posted: Wed Jan 11, 2012 4:33 pm
by Comtois
Use a delay when there is no more event.

Code: Select all

  Repeat
    
    EventID = WindowEvent()
    
    Select EventID
        
      Case 0
        
        Delay(10)
        
      Case #PB_Event_CloseWindow
        Quit = 1
        
      Case #PB_Event_Gadget
        
        Select EventGadget()
            
        EndSelect
        
    EndSelect   
    
  Until Quit

Re: The window is building slow, why ?

Posted: Wed Jan 11, 2012 4:34 pm
by Fred
Better use the timeout param of WaitWindowEvent():

Code: Select all

Repeat
   
    EventID = WaitWindowEvent(20)
   
    Select EventID
       
      Case #PB_Event_CloseWindow
        Quit = 1
       
      Case #PB_Event_Gadget
       
        Select EventGadget()
           
        EndSelect
       
    EndSelect   
   
  Until Quit