Volunteers needed - TreeGadget CheckBox not responding

Linux specific forum
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Volunteers needed - TreeGadget CheckBox not responding

Post by StarBootics »

Hello everyone,

Here I go again experiencing a problem with the TreeGadget() with checkboxes. I can click on the checkbox like crazy the checkbox state don't change. There is a code, can a volunteer confirm this before I post this in the bug section.

Best regards
StarBootics

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : TreeGadget CheckBox not responding
; File Name : TreeGadget CheckBox not responding.pb
; File version: 1.0.0
; Programming : Potential Bug Demonstrator
; Programmed by : StarBootics
; Date : 17-05-2021
; Last Update : 17-05-2021
; PureBasic code : 5.73 LTS
; Platform : Ubuntu 21.04 (Hirsute Hippo) x86-64
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Bug description
;
; The TreeGadget with CheckBox, the state don't change 
; after a click on it. If the checkbox is being set by
; SetGadgetItemState(1, 0, #PB_Tree_Checked) instruction
; it remain in that state no matter what we do. We can 
; click on the checkbox like crazy the state don't change.
;
; And it's the same when the CheckBox is not Checked.
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

If OpenWindow(0, 400, 300, 400, 300, "TreeGadget", #PB_Window_SystemMenu)
  
  TreeGadget(1, 5, 5, 390, 290, #PB_Tree_CheckBoxes)
  
  For a = 0 To 10
    AddGadgetItem(1, -1, "Elément normal "+Str(a), 0, 0)
    AddGadgetItem(1, -1, "Noeud "+Str(a), 0, 0)      
    AddGadgetItem(1, -1, "Sous-élément 1", 0, 1)       
    AddGadgetItem(1, -1, "Sous-élément 2", 0, 1)
    AddGadgetItem(1, -1, "Sous-élément 3", 0, 1)
    AddGadgetItem(1, -1, "Sous-élément 4", 0, 1)
    AddGadgetItem(1, -1, "Fichier "+Str(a), 0, 0)
  Next
  
  SetGadgetItemState(1, 0, #PB_Tree_Checked) 

  Repeat
    
    Select WaitWindowEvent()
        
      Case #PB_Event_Gadget
        
        Select EventGadget()
            
          Case 1
            
            If EventType() = #PB_EventType_Change ; LeftClick 
              
              Result.i = GetGadgetItemState(1, GetGadgetState(1)) 
              
              Debug Str(Result)
              Debug Str(Result & #PB_Tree_Checked)
              Debug Str(#PB_Tree_Checked)
              
              If Result & #PB_Tree_Checked
                Debug "Checked!"
              Else
                Debug "Not Checked!"
              EndIf
              
            EndIf
            
        EndSelect
        
      Case #PB_Event_CloseWindow
        
        Select EventWindow()
            
          Case 0
            Break
            
        EndSelect
        
    EndSelect
    
  ForEver
  
EndIf

; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
The Stone Age did not end due to a shortage of stones !
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 275
Joined: Thu Jul 09, 2015 9:07 am

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by pf shadoko »

It works well for me
(pb 5.73 64bit windows)
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by StarBootics »

pf shadoko wrote: Mon May 17, 2021 3:00 pm It works well for me
(pb 5.73 64bit windows)
You are on windows. We are in the Linux forum section.
The Stone Age did not end due to a shortage of stones !
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by mk-soft »

No problem here ...

PB: v5.73
OS: VM Ubuntu 20.04

Edit:

Small example how to create new event type item checked or unchecked
Work fine here

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : TreeGadget CheckBox not responding
; File Name : TreeGadget CheckBox not responding.pb
; File version: 1.0.0
; Programming : Potential Bug Demonstrator
; Programmed by : StarBootics
; Date : 17-05-2021
; Last Update : 17-05-2021
; PureBasic code : 5.73 LTS
; Platform : Ubuntu 21.04 (Hirsute Hippo) x86-64
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Bug description
;
; The TreeGadget with CheckBox, the state don't change 
; after a click on it. If the checkbox is being set by
; SetGadgetItemState(1, 0, #PB_Tree_Checked) instruction
; it remain in that state no matter what we do. We can 
; click on the checkbox like crazy the state don't change.
;
; And it's the same when the CheckBox is not Checked.
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

If OpenWindow(0, 400, 300, 400, 300, "TreeGadget", #PB_Window_SystemMenu)
  
  TreeGadget(1, 5, 5, 390, 290, #PB_Tree_CheckBoxes)
  
  For a = 0 To 10
    AddGadgetItem(1, -1, "Elément normal "+Str(a), 0, 0)
    AddGadgetItem(1, -1, "Noeud "+Str(a), 0, 0)      
    AddGadgetItem(1, -1, "Sous-élément 1", 0, 1)       
    AddGadgetItem(1, -1, "Sous-élément 2", 0, 1)
    AddGadgetItem(1, -1, "Sous-élément 3", 0, 1)
    AddGadgetItem(1, -1, "Sous-élément 4", 0, 1)
    AddGadgetItem(1, -1, "Fichier "+Str(a), 0, 0)
  Next
  
  SetGadgetItemState(1, 0, #PB_Tree_Checked) 
  
  ; Init Tree Item data
  cnt = CountGadgetItems(1) - 1
  For item = 0 To cnt
    state = GetGadgetItemState(1, item) & #PB_Tree_Checked
    SetGadgetItemData(1, item, state)
  Next
  
  Repeat
    
    Select WaitWindowEvent()
        
      Case #PB_Event_Gadget
        
        Select EventGadget()
            
          Case 1
            
            Select EventType()
              Case #PB_EventType_LeftClick 
                item = GetGadgetState(1)
                If item >= 0
                  state = GetGadgetItemState(1, item) & #PB_Tree_Checked
                  If state <> GetGadgetItemData(1, item)
                    SetGadgetItemData(1, item, state)
                    PostEvent(#PB_Event_Gadget, EventWindow(), 1, #PB_EventType_StatusChange, item)
                  EndIf
                EndIf
                
              Case #PB_EventType_StatusChange
                item = EventData()
                Result.i = GetGadgetItemState(1, item) 
                If Result & #PB_Tree_Checked
                  Debug "Item " + item + " Checked!"
                Else
                  Debug "Item " + item + " Not Checked!"
                EndIf
                
            EndSelect
            
        EndSelect
        
      Case #PB_Event_CloseWindow
        
        Select EventWindow()
            
          Case 0
            Break
            
        EndSelect
        
    EndSelect
    
  ForEver
  
EndIf

; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
preacher
New User
New User
Posts: 6
Joined: Fri Apr 25, 2003 6:45 pm
Location: Norway

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by preacher »

I Confirm that it do not work, at least on Ubuntu Budgie 21.04 .

No checkmark change at all when clicking on them :-(

Edit: But they work if I add image to the items.
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by StarBootics »

mk-soft wrote: Mon May 17, 2021 7:22 pm No problem here ...

PB: v5.73
OS: VM Ubuntu 20.04

Edit:

Small example how to create new event type item checked or unchecked
Work fine here

Code: Select all

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : TreeGadget CheckBox not responding
; File Name : TreeGadget CheckBox not responding.pb
; File version: 1.0.0
; Programming : Potential Bug Demonstrator
; Programmed by : StarBootics
; Date : 17-05-2021
; Last Update : 17-05-2021
; PureBasic code : 5.73 LTS
; Platform : Ubuntu 21.04 (Hirsute Hippo) x86-64
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Bug description
;
; The TreeGadget with CheckBox, the state don't change 
; after a click on it. If the checkbox is being set by
; SetGadgetItemState(1, 0, #PB_Tree_Checked) instruction
; it remain in that state no matter what we do. We can 
; click on the checkbox like crazy the state don't change.
;
; And it's the same when the CheckBox is not Checked.
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

If OpenWindow(0, 400, 300, 400, 300, "TreeGadget", #PB_Window_SystemMenu)
  
  TreeGadget(1, 5, 5, 390, 290, #PB_Tree_CheckBoxes)
  
  For a = 0 To 10
    AddGadgetItem(1, -1, "Elément normal "+Str(a), 0, 0)
    AddGadgetItem(1, -1, "Noeud "+Str(a), 0, 0)      
    AddGadgetItem(1, -1, "Sous-élément 1", 0, 1)       
    AddGadgetItem(1, -1, "Sous-élément 2", 0, 1)
    AddGadgetItem(1, -1, "Sous-élément 3", 0, 1)
    AddGadgetItem(1, -1, "Sous-élément 4", 0, 1)
    AddGadgetItem(1, -1, "Fichier "+Str(a), 0, 0)
  Next
  
  SetGadgetItemState(1, 0, #PB_Tree_Checked) 
  
  ; Init Tree Item data
  cnt = CountGadgetItems(1) - 1
  For item = 0 To cnt
    state = GetGadgetItemState(1, item) & #PB_Tree_Checked
    SetGadgetItemData(1, item, state)
  Next
  
  Repeat
    
    Select WaitWindowEvent()
        
      Case #PB_Event_Gadget
        
        Select EventGadget()
            
          Case 1
            
            Select EventType()
              Case #PB_EventType_LeftClick 
                item = GetGadgetState(1)
                If item >= 0
                  state = GetGadgetItemState(1, item) & #PB_Tree_Checked
                  If state <> GetGadgetItemData(1, item)
                    SetGadgetItemData(1, item, state)
                    PostEvent(#PB_Event_Gadget, EventWindow(), 1, #PB_EventType_StatusChange, item)
                  EndIf
                EndIf
                
              Case #PB_EventType_StatusChange
                item = EventData()
                Result.i = GetGadgetItemState(1, item) 
                If Result & #PB_Tree_Checked
                  Debug "Item " + item + " Checked!"
                Else
                  Debug "Item " + item + " Not Checked!"
                EndIf
                
            EndSelect
            
        EndSelect
        
      Case #PB_Event_CloseWindow
        
        Select EventWindow()
            
          Case 0
            Break
            
        EndSelect
        
    EndSelect
    
  ForEver
  
EndIf

; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<
I'm sorry to report that your example don't work here on Ubuntu 21.04 x64. Since I'm not alone should I report this as bug or not ?

Or bump this old thread https://www.purebasic.fr/english/viewto ... 35#p535735 ?

Fred if you read this, your advice will be appreciated, thank you.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
idle
Always Here
Always Here
Posts: 5019
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by idle »

doesn't work on manjaro either unless I specify gtk2 subsytem
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by StarBootics »

idle wrote: Tue May 18, 2021 1:39 am doesn't work on manjaro either unless I specify gtk2 subsytem
Same here with Ubuntu 21.04 and gtk2 subsystem. The problem is, for the program I'm working on I can't simply switch to gtk2 because of the difference in the Gadget Size between GTK2 and GTK3. The main window as only few gadgets but I have lost track on the custom requester I have for that particular program. Adjusting all of that will take hours of trial and errors and my time is too precious to redo the work again.

Apparently the ListIconGadget() with 1 column and with the option to have checkbox can be an alternative to the TreeGadget(). So I think I will make the change.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by mk-soft »

I have set up a VM with Ubuntu 21.04.

I can therefore confirm the bug. I just don't know if the bug is with GTK or if something has been changed again.
With a small image (4x4 pix) you can avoid the bug until it is resolved.

Code: Select all

;-TOP

; Fix Ubuntu 21.04 Treegadget with checkbox
; Create and add small dummy image

CompilerIf #PB_Compiler_OS = #PB_OS_Linux
  Global _treegadget_dummy_image_ = ImageID(CreateImage(#PB_Any, 4, 4, 32, $FFFFFFFF))
  Procedure FixTreeGadget_AddGadgetItem(Gadget, Position, Text.s, Image = 0, Flags = 0)
    If Not Image And GadgetType(Gadget) = #PB_GadgetType_Tree
      AddGadgetItem(Gadget, Position, Text.s, _treegadget_dummy_image_, Flags)
    Else
      AddGadgetItem(Gadget, Position, Text.s, Image, Flags)
    EndIf
  EndProcedure
  
  Macro AddGadgetItem(Gadget, Position, Text, Image = 0, Flags = 0)
    FixTreeGadget_AddGadgetItem(Gadget, Position, Text, Image, Flags)
  EndMacro
CompilerEndIf

If OpenWindow(0, 400, 300, 400, 300, "TreeGadget", #PB_Window_SystemMenu)
  
  TreeGadget(1, 5, 5, 390, 290, #PB_Tree_CheckBoxes | #PB_Tree_AlwaysShowSelection)
  
  For a = 0 To 10
    AddGadgetItem(1, -1, "Elément normal "+Str(a), 0, 0)
    AddGadgetItem(1, -1, "Noeud "+Str(a), 0, 0)      
    AddGadgetItem(1, -1, "Sous-élément 1", 0, 1)       
    AddGadgetItem(1, -1, "Sous-élément 2", 0, 1)
    AddGadgetItem(1, -1, "Sous-élément 3", 0, 1)
    AddGadgetItem(1, -1, "Sous-élément 4", 0, 1)
    AddGadgetItem(1, -1, "Fichier "+Str(a), 0, 0)
  Next
  
  SetGadgetItemState(1, 0, #PB_Tree_Checked) 
  
  ; Init Tree Item data
  cnt = CountGadgetItems(1) - 1
  For item = 0 To cnt
    state = GetGadgetItemState(1, item) & #PB_Tree_Checked
    SetGadgetItemData(1, item, state)
  Next
  
  Repeat
    
    Select WaitWindowEvent()
        
      Case #PB_Event_Gadget
        
        Select EventGadget()
            
          Case 1
            Select EventType()
              Case #PB_EventType_LeftClick 
                item = GetGadgetState(1)
                If item >= 0
                  state = GetGadgetItemState(1, item) & #PB_Tree_Checked
                  If state <> GetGadgetItemData(1, item)
                    SetGadgetItemData(1, item, state)
                    PostEvent(#PB_Event_Gadget, EventWindow(), 1, #PB_EventType_StatusChange, item)
                  EndIf
                EndIf
                
              Case #PB_EventType_StatusChange
                item = EventData()
                Result.i = GetGadgetItemState(1, item) 
                If Result & #PB_Tree_Checked
                  Debug "Item " + item + " Checked!"
                Else
                  Debug "Item " + item + " Not Checked!"
                EndIf
                
            EndSelect
            
        EndSelect
        
      Case #PB_Event_CloseWindow
        
        Select EventWindow()
            
          Case 0
            Break
            
        EndSelect
        
    EndSelect
    
  ForEver
  
EndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by StarBootics »

@mk-soft : Thanks for the workaround :wink:

I shouldn't have upgraded Ubuntu from 20.04.2. The 21.04 version as some instability problems.

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
mk-soft
Always Here
Always Here
Posts: 5313
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by mk-soft »

I have it easier there.
If the update doesn't work, I throw the whole Linux PC with the mouse into the rubbish bin.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Volunteers needed - TreeGadget CheckBox not responding

Post by StarBootics »

mk-soft wrote: Thu May 20, 2021 7:50 pm I have it easier there.
If the update doesn't work, I throw the whole Linux PC with the mouse into the rubbish bin.
That the bright side to have an OS installed in a Virtual Machine you can only press de delete button on the particular machine and Voilà !

My current PC is getting little bit old and I wish I could replace it but for the moment the price of computer parts is just off the charts right now so I'm keeping it. :wink:

Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Post Reply