Page 1 of 1
					
				[Done] PB 6.21 PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 4:48 pm
				by marcoagpinto
				Heya,
I noticed this minutes ago.
It works well on Windows 11.
Code: Select all
OpenWindow(1,10,10,800,600,"Testing",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget)    
OpenWindow(2,0,0,640,480,"About",#PB_Window_WindowCentered,WindowID(1))
DisableWindow(1,#True)
  x=10
  y=10
  
  ; Current PureBasic information
  Global current_version_purebasic$="6.21"
  Global current_release_date_purebasic$="2025-06-09"
  
  t$=""+#LF$
  t$+"Compiled using PureBasic "+current_version_purebasic$+" — "+current_release_date_purebasic$+#LF$
  t$+Chr(34)+"Feel the ..Pure.. Power"+Chr(34)+#LF$+#LF$
  t$+"© 1998–"+FormatDate("%yyyy", #PB_Compiler_Date)+" Fantaisie Software."+#LF$
  t$+"www.purebasic.com"
  TextGadget(1,x,y,320,240,t$,#PB_Text_Border|#PB_Text_Center)
  SetGadgetColor(1,#PB_Gadget_BackColor,#White)
  okay=#False
  Repeat
      
    event=WaitWindowEvent()
      
     
    If event=#PB_Event_CloseWindow
      okay=#True     
    EndIf      
      
  Until okay=#True
    
  ; Close the About window and activate the main window
  DisableWindow(1,#False)
  CloseWindow(2)
Thanks!
 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 5:46 pm
				by mk-soft
				Multiline Center not supported by GTK Linux
- PB v6.12 to v6.21
- Mint Linux LMDE 6
			 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 5:51 pm
				by marcoagpinto
				mk-soft wrote: Thu Jun 12, 2025 5:46 pm
Multiline Center not supported by GTK Linux
- PB v6.12 to v6.21
- Mint Linux LMDE 6
 
Buaaaaaaaaaaaaaaaaaa...
But it was one of you from the forum who told me to replace the EditorGadget with a TextGadget so that I could centre the text.
Now it doesn't work?
 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 6:26 pm
				by Caronte3D
				Maybe you can center it adding spaces, not elegant, but...
			 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 7:18 pm
				by mk-soft
				
			 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 7:26 pm
				by mk-soft
				Solution ... gtk_label_set_justify 
 
 
Code: Select all
OpenWindow(1,10,10,800,600,"Testing",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget)    
OpenWindow(2,0,0,640,480,"About",#PB_Window_WindowCentered,WindowID(1))
DisableWindow(1,#True)
  x=10
  y=10
  
  ; Current PureBasic information
  Global current_version_purebasic$="6.21"
  Global current_release_date_purebasic$="2025-06-09"
  
  t$=""+#LF$
  t$+"Compiled using PureBasic "+current_version_purebasic$+" — "+current_release_date_purebasic$+#CR$
  t$+Chr(34)+"Feel the ..Pure.. Power"+Chr(34)+#LF$+#LF$
  t$+"© 1998–"+FormatDate("%yyyy", #PB_Compiler_Date)+" Fantaisie Software."+#LF$
  t$+"www.purebasic.com"
  TextGadget(1,x,y,320,240,t$,#PB_Text_Border|#PB_Text_Center)
  SetGadgetColor(1,#PB_Gadget_BackColor,#White)
  
  CompilerIf #PB_Compiler_OS = #PB_OS_Linux
    gtk_label_set_justify_(GadgetID(1), #GTK_JUSTIFY_CENTER)
  CompilerEndIf
  
  okay=#False
  Repeat
      
    event=WaitWindowEvent()
      
     
    If event=#PB_Event_CloseWindow
      okay=#True     
    EndIf      
      
  Until okay=#True
    
  ; Close the About window and activate the main window
  DisableWindow(1,#False)
  CloseWindow(2)
 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 9:03 pm
				by marcoagpinto
				mk-soft wrote: Thu Jun 12, 2025 7:26 pm
Solution ... gtk_label_set_justify 
 
 
Code: Select all
OpenWindow(1,10,10,800,600,"Testing",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget)    
OpenWindow(2,0,0,640,480,"About",#PB_Window_WindowCentered,WindowID(1))
DisableWindow(1,#True)
  x=10
  y=10
  
  ; Current PureBasic information
  Global current_version_purebasic$="6.21"
  Global current_release_date_purebasic$="2025-06-09"
  
  t$=""+#LF$
  t$+"Compiled using PureBasic "+current_version_purebasic$+" — "+current_release_date_purebasic$+#CR$
  t$+Chr(34)+"Feel the ..Pure.. Power"+Chr(34)+#LF$+#LF$
  t$+"© 1998–"+FormatDate("%yyyy", #PB_Compiler_Date)+" Fantaisie Software."+#LF$
  t$+"www.purebasic.com"
  TextGadget(1,x,y,320,240,t$,#PB_Text_Border|#PB_Text_Center)
  SetGadgetColor(1,#PB_Gadget_BackColor,#White)
  
  CompilerIf #PB_Compiler_OS = #PB_OS_Linux
    gtk_label_set_justify_(GadgetID(1), #GTK_JUSTIFY_CENTER)
  CompilerEndIf
  
  okay=#False
  Repeat
      
    event=WaitWindowEvent()
      
     
    If event=#PB_Event_CloseWindow
      okay=#True     
    EndIf      
      
  Until okay=#True
    
  ; Close the About window and activate the main window
  DisableWindow(1,#False)
  CloseWindow(2)
 
Brilliant genius <3 <3 <3 <3 <3 <3 <3 <3 <3
 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 9:05 pm
				by marcoagpinto
				But can't Fred make that built-in so that we don't have to write extra code (so that it works out of the box)?
			 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 9:29 pm
				by mk-soft
				I think yes ...
I found this on my includes ...
Link: 
SetTextAlignment (All OS) 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 9:33 pm
				by marcoagpinto
				I was going to make a donation to Fred next month after I receive the holidays income.
Maybe I could pay for him to implement instead of being a mere donation.
			 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Thu Jun 12, 2025 10:16 pm
				by mk-soft
				Workaround for Linux ...
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
  Procedure _LinuxTextGadget(Gadget, x, y, Width, Height, Text$, Flags = 0)
    Protected r1 = TextGadget(Gadget, x, y, Width, Height, Text$, Flags)
    Protected widget
    If Gadget = #PB_Any
      widget = GadgetID(r1)
    Else
      widget = r1
    EndIf
    If Flags & #PB_Text_Center
      gtk_label_set_justify_(widget, #GTK_JUSTIFY_CENTER)
    ElseIf Flags & #PB_Text_Right
      gtk_label_set_justify_(widget, #GTK_JUSTIFY_RIGHT)
    EndIf
    ProcedureReturn r1
  EndProcedure
  
  Macro TextGadget(Gadget, x, y, Width, Height, Text, Flags=0)
    _LinuxTextGadget(Gadget, x, y, Width, Height, Text, Flags)
  EndMacro
  
CompilerEndIf
 
			
					
				Re: [PB 6.21] PB_Text_Center doesn't work on TextGadgets on Ubuntu 24.04
				Posted: Fri Sep 12, 2025 3:00 pm
				by Fred
				Fixed.