[Module] TextEx - Extended TextGadget (All OS / DPI)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

[Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Thorsten1867 »

TextEx Gadget - Module (All OS / DPI)
  • Background with color gradient
  • Multiline text
  • DPI support
  • Automatic size adjustment (#MoveX|#MoveY|#ResizeWidth|#ResizeHeight)
Image

Code: Select all

; TextEx::Gadget()             - similar to 'TextGadget()'
; TextEx::GetColor()           - similar to 'GetGadgetColor()'
; TextEx::GetText()            - similar to 'GetGadgetText()'
; TextEx::SetColor()           - similar to 'SetGadgetColor()'
; TextEx::SetFont()            - similar to 'SetGadgetFont()'
; TextEx::SetText()            - similar to 'SetGadgetText()'
; TextEx::SetAutoResizeFlags() - [#MoveX|#MoveY|#ResizeWidth|#ResizeHeight]
Download: TextExModule.pbi
Last edited by Thorsten1867 on Fri Dec 20, 2019 3:37 pm, edited 3 times in total.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Zebuddi123 »

Thank you Thorsten1867 yet another very useful addition :)

Zebuddi.
malleo, caput, bang. Ego, comprehendunt in tempore
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Cyllceaux »

This is cool...

Really thanks you
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Kwai chang caine »

Works fine
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
Cyllceaux
Enthusiast
Enthusiast
Posts: 458
Joined: Mon Jun 23, 2014 1:18 pm
Contact:

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Cyllceaux »

Now, its missing the Themes :)
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Thorsten1867 »

Fixed
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by ozzie »

How do I get AutoResize to work? The example includes the line:

Code: Select all

;TextEx::SetAutoResizeFlags(#Text, TextEx::#MoveY|TextEx::#ResizeWidth)
but if I remove the ; comment marker the results are still the same, with the displayed gadget still being 170 pixels wide.
(Using TextExModule version 19120800 with PB 5.71 LTS 64-bit under Windows 10)
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Thorsten1867 »

I can't find a problem.

Image
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by ozzie »

I misunderstood the purpose. I was expecting the gadget to be resized to match the required size, eg to match #PB_Gadget_RequiredSize.

How can I resize the gadget myself? It doesn't seem to have a SetWidth or Resize function (similarly for other modules).
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Thorsten1867 »

ozzie wrote:I misunderstood the purpose. I was expecting the gadget to be resized to match the required size, eg to match #PB_Gadget_RequiredSize.

How can I resize the gadget myself? It doesn't seem to have a SetWidth or Resize function (similarly for other modules).

Code: Select all

ResizeGadget()
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by ozzie »

Thanks. I didn't realise these native PB functions would work on the modules, but on checking this I see you use BindGadgetEvent() calls to catch and process these native functions. Brilliant!
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Thorsten1867 »

Update: TextEx::AdjustSize()
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by davido »

@Thorsten1867,

Module TextEx
#Version = 19122900
#ModuleEx = 19112102

I have been using TextEx on my MacBook and have discovered a minor problem with your example:
The box with rounded corners appears to have rectangular box beneath it.

Also I have a question:
Is there some way making the text wrap if it is longer than the box, when #Multiline is specified?
DE AA EB
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Thorsten1867 »

Added: #GadgetColor for SetColor()
The box with rounded corners appears to have rectangular box beneath it.
This will delete the content of the CanvasGadget (= background color), if you have changed the background color, you can adjust it with #GadgetColor.
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
User avatar
Thorsten1867
Addict
Addict
Posts: 1366
Joined: Wed Aug 24, 2005 4:02 pm
Location: Germany

Re: [Module] TextEx - Extended TextGadget (All OS / DPI)

Post by Thorsten1867 »

davido wrote:Is there some way making the text wrap if it is longer than the box?
Update: #WordWrap added
Translated with http://www.DeepL.com/Translator

Download of PureBasic - Modules
Download of PureBasic - Programs

[Windows 11 x64] [PB V5.7x]
Post Reply