It is currently Mon Dec 09, 2019 3:42 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Frustrated With Linux
PostPosted: Fri Aug 09, 2019 6:50 am 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1034
Location: Portugal
Reported problem with combo gadgets on linux in another post but after yet another email from a frustrated Linux user of my application thought I would see what the problem is.

Wrote a little code to see what is happening:-
Code:
Global Window_0

Global Combo_0, btnMag1, ListView_0, btnMag2, btnShort, btnLong,txtShort

Enumeration FormFont
  #Font_Window_0_0
EndEnumeration

LoadFont(#Font_Window_0_0,"Sans", 16)




Define Event.i,iLoop.i





  Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
  btnMag2 = ButtonGadget(#PB_Any, 330, 10, 110, 25, "Magic 2")
  btnMag1 = ButtonGadget(#PB_Any, 210, 10, 110, 20, "Magic 1")
 
  Combo_0 = ComboBoxGadget(#PB_Any, 10, 10, 160, 30)

  ListView_0 = ListViewGadget(#PB_Any, 10, 60, 160, 150)
 
  btnShort = ButtonGadget(#PB_Any, 10, 230, 90, 30, "Short")
  btnLong = ButtonGadget(#PB_Any, 130, 230, 90, 30, "Long")
  btnFont = ButtonGadget(#PB_Any, 250, 230, 90, 30, "Font")
  txtShort = TextGadget(#PB_Any, 210, 140, 120, 20, "Short")
  txtImportant = TextGadget(#PB_Any, 270, 140, 60, 20, "Important")
 
   
 
 
 
  Repeat
   
    Event = WaitWindowEvent()
 
 

  Select event
    Case #PB_Event_CloseWindow
      End

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
         
        Case btnFont
         
          SetGadgetFont(btnMag1, FontID(#Font_Window_0_0))
          SetGadgetFont(txtShort, FontID(#Font_Window_0_0))
         
        Case btnMag1
         
          Debug "Magic 1"
         
         
        Case btnMag2
         
          Debug "Magic 2"
         
        Case btnShort
         
          ClearGadgetItems(Combo_0)
          ClearGadgetItems(ListView_0)
         
          For iLoop = 0 To 20
         
          AddGadgetItem(Combo_0,-1,"Item " + Str(iLoop))
          AddGadgetItem(ListView_0,-1,"Item " + Str(iLoop))
        Next
       
        SetGadgetText(btnMag1,"Magic 1")
        SetGadgetText(txtShort,"Short")
       
      Case btnLong 
       
               ClearGadgetItems(Combo_0)
          ClearGadgetItems(ListView_0)   
       
       
        For iLoop = 0 To 20
         
          AddGadgetItem(Combo_0,-1,"Item " + Str(iLoop) + " A much Longer String To Check It Out. The Quick Brown Fox Jumps Over The Lazy Dog.")
          AddGadgetItem(ListView_0,-1,"Item " + Str(iLoop) + " A much Longer String To Check It Out")
        Next
       
        SetGadgetText(btnMag1,"Just Checking it out")
        SetGadgetText(txtShort,"Checking How text Gadgets React")
         
      EndSelect
  EndSelect
 
  ForEver


Seems to be more of a mess than I first thought!

I have resolved the Linux user problem by taking my linux applications off line, no more emails from 'Frustrated'.

Is there anyway around this auto resizeing? Or do I just give up on writing applications for Linux?

CD

_________________
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.


Top
 Profile  
Reply with quote  
 Post subject: Re: Frustrated With Linux
PostPosted: Fri Aug 09, 2019 9:59 pm 
Offline
User
User
User avatar

Joined: Mon Apr 19, 2004 8:22 pm
Posts: 89
Location: NORWAY
Purebasic has quite a few quirks with gtk3 sizing.
Have you tried compiling with gtk2?


Top
 Profile  
Reply with quote  
 Post subject: Re: Frustrated With Linux
PostPosted: Fri Aug 09, 2019 10:21 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 10, 2017 6:17 pm
Posts: 301
Location: Germany
Two possible further options are trying with 5.71 Beta 3 or try to use the QT subsystem.

_________________
webpage


Top
 Profile  
Reply with quote  
 Post subject: Re: Frustrated With Linux
PostPosted: Sat Aug 10, 2019 6:24 am 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1034
Location: Portugal
Thanks for the replies.

How do I compile with GTK 2?

CD

_________________
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.


Top
 Profile  
Reply with quote  
 Post subject: Re: Frustrated With Linux
PostPosted: Sat Aug 10, 2019 10:30 am 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2053
Location: Germany
Compiler option subsystem "gtk2"

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Frustrated With Linux
PostPosted: Sat Aug 10, 2019 5:27 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Jun 26, 2014 9:17 am
Posts: 308
Location: Germany
Attention: Not very well tested. This means that the method is not bulletproof.

The ComboBox is unfortunately the worst gadget in Gtk3.
The only method I found to eliminate the dynamic width is to set the editable flag and block the effect of this flag via API.

My Linux-Api-Lib code for the issue can be found here:
http://www.chabba.de/Linux/ComboBoxGadg ... nd_Gtk3.pb

Here your example in revised form for Gtk3 ...
Code:
; Addit **********
ImportC ""
   gtk_widget_set_can_focus(*widget.GtkWidget, can_focus)
EndImport
; **********

Global Window_0

Global Combo_0, btnMag1, ListView_0, btnMag2, btnShort, btnLong,txtShort

Enumeration FormFont
  #Font_Window_0_0
EndEnumeration

LoadFont(#Font_Window_0_0,"Sans", 16)

; Addit **********
Procedure ComboBoxGadget_Gtk3Tweak(Gadget)
   CompilerIf #PB_Compiler_OS = #PB_OS_Linux
      If GadgetType(Gadget) = #PB_GadgetType_ComboBox
         Protected *entry.GtkEntry = gtk_bin_get_child_(GadgetID(Gadget))
         
         If *entry
            If PeekS(gtk_widget_get_name_(*entry), -1, #PB_UTF8) = "GtkEntry"
               gtk_editable_set_editable_(*entry, #False)
               gtk_widget_set_can_focus(*entry, #False)
            EndIf
         EndIf
      EndIf
   CompilerEndIf
EndProcedure
; **********

Define Event.i,iLoop.i





  Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
  btnMag2 = ButtonGadget(#PB_Any, 330, 10, 110, 25, "Magic 2")
  btnMag1 = ButtonGadget(#PB_Any, 210, 10, 110, 20, "Magic 1")
 
  Combo_0 = ComboBoxGadget(#PB_Any, 10, 10, 160, 30, #PB_ComboBox_Editable);         FLAG ADDED !!!!

  ListView_0 = ListViewGadget(#PB_Any, 10, 60, 160, 150)
 
  btnShort = ButtonGadget(#PB_Any, 10, 230, 90, 30, "Short")
  btnLong = ButtonGadget(#PB_Any, 130, 230, 90, 30, "Long")
  btnFont = ButtonGadget(#PB_Any, 250, 230, 90, 30, "Font")
  txtShort = TextGadget(#PB_Any, 210, 140, 120, 20, "Short")
  txtImportant = TextGadget(#PB_Any, 270, 140, 60, 20, "Important")
 
  ; **********
  ComboBoxGadget_Gtk3Tweak(Combo_0);                                                 FLAG effect eliminated
  ; **********
 
 
  Repeat
   
    Event = WaitWindowEvent()
 
 

  Select event
    Case #PB_Event_CloseWindow
      End

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
         
        Case btnFont
         
          SetGadgetFont(btnMag1, FontID(#Font_Window_0_0))
          SetGadgetFont(txtShort, FontID(#Font_Window_0_0))
         
        Case btnMag1
         
          Debug "Magic 1"
         
         
        Case btnMag2
         
          Debug "Magic 2"
         
        Case btnShort
         
          ClearGadgetItems(Combo_0)
          ClearGadgetItems(ListView_0)
         
          For iLoop = 0 To 20
         
          AddGadgetItem(Combo_0,-1,"Item " + Str(iLoop))
          AddGadgetItem(ListView_0,-1,"Item " + Str(iLoop))
        Next
       
        SetGadgetText(btnMag1,"Magic 1")
        SetGadgetText(txtShort,"Short")
       
      Case btnLong
       
               ClearGadgetItems(Combo_0)
          ClearGadgetItems(ListView_0)   
       
       
        For iLoop = 0 To 20
         
          AddGadgetItem(Combo_0,-1,"Item " + Str(iLoop) + " A much Longer String To Check It Out. The Quick Brown Fox Jumps Over The Lazy Dog.")
          AddGadgetItem(ListView_0,-1,"Item " + Str(iLoop) + " A much Longer String To Check It Out")
        Next
       
        SetGadgetText(btnMag1,"Just Checking it out")
        SetGadgetText(txtShort,"Checking How text Gadgets React")
         
      EndSelect
  EndSelect
 
  ForEver

However, if your content varies so much I would also choose Gtk2, or Qt.

Regards, Charly

_________________
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de


Top
 Profile  
Reply with quote  
 Post subject: Re: Frustrated With Linux
PostPosted: Wed Aug 14, 2019 4:52 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 634
Solution here:
https://www.purebasic.fr/english/viewtopic.php?f=12&t=73397


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye