A bug ? Gadgets passing events to canvas-parent... ? (Ubuntut)

Just starting out? Need help? Post your questions and find answers here.
Joris
Addict
Addict
Posts: 885
Joined: Fri Oct 16, 2009 10:12 am
Location: BE

A bug ? Gadgets passing events to canvas-parent... ? (Ubuntut)

Post by Joris »

Hi,

Working and testing on (latest) Ubuntu 64bit.

In the setup below (part of a bigger one) the gadgets btn_SavePrf, btn_LoadPrf, btn_NewPrf, btn_SendPrf
pass there event also to the parent canvas gadget.
So there are two different events by one press (on ButtonUp) ???

What is the reason, and/or how to prevent this ?

Thanks.

Code: Select all

Global.i Cv_Kbrd,lvw_Out,cnv_prf,splt,Window_0, btn_ShowFaders, btn_Cnvrt
Global.i cnt_A1, txt_001, txt_002, txt_003, txt_004, btn_SavePrf, btn_LoadPrf, btn_NewPrf, btn_SendPrf 
Procedure OpenWindow_0(width = 645, height = 380)
      Protected hicon.i
      
      Window_0 = OpenWindow(#PB_Any,#PB_Ignore, #PB_Ignore, width, height, "", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget |#PB_Window_SizeGadget)
      WindowBounds(Window_0,width,260, width, height) ;780)  ;800 bepaald de maximum hoogte van het venster
         
      lvw_M_In = ListViewGadget(#PB_Any, 15, 30, 210, 115) 
      lvw_M_Out = ListViewGadget(#PB_Any, 425, 30, 210, 115)
       btn_ShowFaders = ButtonGadget(#PB_Any,310, 50, 55, 20, "SET", #PB_Button_Toggle)
      ;****************************************************************************
      Cv_Kbrd=CanvasGadget(#PB_Any,60, 182,  200,23)
      ;****************************************************************************
      lvw_Out = ListViewGadget(#PB_Any,  0,0,0,0) ;,  #PB_ListView_MultiSelect) ;opgelet Lvw_ItemSelect-verschuiving werkt niet meer met #PB_ListView_MultiSelect
      ;****************************************************************************
      cnv_prf=CanvasGadget(#PB_Any, 0,0,0,0, #PB_Canvas_Keyboard | #PB_Canvas_Container)
      ;****************************************************************************
      ;****************************************************************************
      If  0
          btn_SavePrf = ButtonGadget(#PB_Any,  445, 2+  15,  40,  20, "Save")
          btn_LoadPrf = ButtonGadget(#PB_Any, 440+ 50,  2+  15,  40,  20, "Load")
          btn_NewPrf = ButtonGadget(#PB_Any,  440+ 95,  2+   15,  40,  20, "New")
          btn_SendPrf = ButtonGadget(#PB_Any, 440+ 140,  2+   15,  42,  20, "Send")
          cmb_Prf = ComboBoxGadget(#PB_Any, 440+ 5,  45, 2+  130,  22)
          btn_Cnvrt = ButtonGadget(#PB_Any, 440+ 140, 45,  2+  42,  20, "Convert")
          ;****************************************************************************
      Else
          cnt_A0 = ContainerGadget(#PB_Any, 440, 2, 200, 80,#PB_Container_Flat)
          btn_SavePrf = ButtonGadget(#PB_Any,    5,   15,  40,  20, "Save")
          btn_LoadPrf = ButtonGadget(#PB_Any,   50,  15,  40,  20, "Load")
          btn_NewPrf = ButtonGadget(#PB_Any,   95,   15,  40,  20, "New")
          btn_SendPrf = ButtonGadget(#PB_Any,  140,   15,  42,  20, "Send")
          cmb_Prf = ComboBoxGadget(#PB_Any,  5,  45, 130,  22)
          btn_Cnvrt = ButtonGadget(#PB_Any,  140, 45,  42,  20, "Convert")
          CloseGadgetList()
      EndIf
      ;****************************************************************************
      ;****************************************************************************
      ;OpenGadgetList(cnv_prf)
      txt_001 = TextGadget(#PB_Any,  35,  90, 114,  17, "---", #PB_Text_Center|#PB_Text_Border)
      txt_002 = TextGadget(#PB_Any, 172,  90, 114,  17, "---", #PB_Text_Center|#PB_Text_Border)
      txt_003 = TextGadget(#PB_Any, 309,  90, 114,  17, "---", #PB_Text_Center|#PB_Text_Border)
      txt_004 = TextGadget(#PB_Any, 446,  90, 114,  17, "---", #PB_Text_Center|#PB_Text_Border)
       CloseGadgetList()                                       
      ;****************************************************************************
      splt=SplitterGadget(#PB_Any, 0, 190 + 50, width, height, lvw_Out, cnv_prf, #PB_Splitter_Separator)
      ;****************************************************************************
      SetGadgetState(splt, 330)
      ResizeWindow(Window_0, #PB_Ignore, #PB_Ignore, #PB_Ignore, 1000) ;565) 
      ;****************************************************************************
      ;****************************************************************************
  
EndProcedure
Procedure Event_Window_Main(EventID.i)
         
      Select EventID
        Case #PB_Event_Gadget :          
          Select EventGadget()
            Case  btn_ShowFaders : Debug "btn_ShowFaders "
              If GetGadgetState(btn_ShowFaders)
                  ResizeWindow(Window_0, #PB_Ignore, #PB_Ignore, #PB_Ignore, 1000) 
                  SetGadgetState(splt, 330)
              Else
                  SetGadgetState(splt, 330)
                  ResizeWindow(Window_0, #PB_Ignore, #PB_Ignore, #PB_Ignore, 565) 
              EndIf
              
            Case btn_Cnvrt :  ClearDebugOutput()

            Case btn_SavePrf:  Debug "btn "
            Case btn_LoadPrf : Debug "btn "
            Case btn_NewPrf : Debug "btn "
            Case btn_SendPrf : Debug "btn "
              
            Case  cnv_prf  :  ;Debug "cnv_prf "
              Select EventType()   
                Case #PB_EventType_LeftButtonDown   : Debug "cnv_prf  down"
                Case #PB_EventType_LeftButtonUp   : Debug "cnv_prf  up"
              EndSelect
              
          EndSelect
          
        Case #PB_Event_CloseWindow
          CloseWindow(Window_0)
          End
      EndSelect
      
EndProcedure
Procedure EventLoop()
      Protected.i  EventID
      
     ; UseJPEGImageDecoder()       ;figuren in jpg zijn tot 50 maal kleiner !!!
      OpenWindow_0(645, 1000)
     ;  Setup_Background()
     ; Setup_Gadgets()
       Repeat
      ;  EventID = WaitWindowEvent()
        Event_Window_Main(WaitWindowEvent())
      ForEver
      
EndProcedure
EventLoop()
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.