double event - help

Just starting out? Need help? Post your questions and find answers here.
Dano
User
User
Posts: 41
Joined: Fri Jul 16, 2004 4:20 am
Location: Edmonton, Ab, Canada

double event - help

Post by Dano »

Ok I'm sure its something simple but when I click on the PanelGadget it seems to fire the same event off twice, can anyone tell me what I am doing wrong?

Code: Select all

Global Window_0

Global Panel_0, Button_01, Editor_0
NewList FaceList.s()
Window_0 = OpenWindow(#PB_Any, 0, 0, 1040, 640, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
Panel_0 = PanelGadget(#PB_Any, 60, 110, 440, 460)
AddGadgetItem(Panel_0, -1, "Program Name")
AddGadgetItem(Panel_0, -1, "Test")
Button_01 = ButtonGadget(#PB_Any, 360,390, 60, 30, "Add")
CloseGadgetList()
Editor_0 = EditorGadget(#PB_Any, 545, 130, 440, 440)
If Window_0
While StLine.s <> "STOP"
  Read.s StLine
  AddElement(FaceList())
  FaceList()=StLine 
Wend
Repeat
    Event = WaitWindowEvent()
    
       Select Event
        Case #PB_Event_CloseWindow
         
          
        Case #PB_Event_Menu
          Select EventMenu()
              
          EndSelect
          
        Case #PB_Event_Gadget
          Select EventGadget()
            Case Panel_0
              WhichPanel = GetGadgetState(Panel_0)
              Debug WhichPanel
              Select WhichPanel
                Case 0  
                  Debug "number 0 picked"
                Case 1 ; Face
                 
                  
                  ForEach FaceList()
                    If FaceList()="STOP"
                      
                    Else                      
                    AddGadgetItem(Editor_0,-1,FaceList())
                    EndIf
                  Next
                  
              EndSelect    
              
          EndSelect
      EndSelect
      
     
  Until Event = #PB_Event_CloseWindow
  
  Else
  MessageRequester("Error","Could Not Open Window")
  End
EndIf
DataSection
  
  
  StringData:
  Data.s "string1","string2","string3","STOP"
EndDataSection
 
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: double event - help

Post by ts-soft »

Code: Select all

          Case Panel_0
            Select EventType()
              Case #PB_EventType_Change
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Dano
User
User
Posts: 41
Joined: Fri Jul 16, 2004 4:20 am
Location: Edmonton, Ab, Canada

Re: double event - help

Post by Dano »

Thanks ts-soft, that did the trick. Much appreciated.
Post Reply