Justify StringGadget and Dialog Library

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Torp
User
User
Posts: 82
Joined: Fri Apr 01, 2005 11:29 am

Justify StringGadget and Dialog Library

Post by Torp »

Hello,

Currently I can force the justification when creating a StringGadget with ES_LEFT # / # ES_CENTER / # ES_RIGHT.
But when creating a GUI with the Dialog library, these flags are not allowed and causes a compiler error.

Would it be possible to integrate a # PB_Text_Left | Center | Right crossplatform, for StringGagdet like TextGadget?

Thanks,
Bye
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Justify StringGadget and Dialog Library

Post by IdeasVacuum »

Those flags already work for Windows apps (unofficially), so perhaps it is a difficult thing on one of the other OS. Certainly would be a welcome enhancement for regular forms, never mind the new dialog.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Fred
Administrator
Administrator
Posts: 16621
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Justify StringGadget and Dialog Library

Post by Fred »

For now, you can declare these constants as "Runtime" and then use it in the XML flags.
Torp
User
User
Posts: 82
Joined: Fri Apr 01, 2005 11:29 am

Re: Justify StringGadget and Dialog Library

Post by Torp »

Arf, I did not understand all the subtleties of Runtime :?:.
Fred
Administrator
Administrator
Posts: 16621
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Justify StringGadget and Dialog Library

Post by Fred »

in your code before loading the XML dialog:

Code: Select all

Runtime #ES_CENTER
the you can use it in the XML.
Torp
User
User
Posts: 82
Joined: Fri Apr 01, 2005 11:29 am

Re: Justify StringGadget and Dialog Library

Post by Torp »

If it's like this, it doesn't works.

Code: Select all

#Xml = 0
#Dialog = 0

Runtime #ES_CENTER

If LoadXML(#Xml, "Data/test.xml") And XMLStatus(#Xml) = #PB_XML_Success
  CreateDialog(#Dialog)
  
  If OpenXMLDialog(#Dialog, #Xml, "Test")

    Repeat
      Event = WaitWindowEvent()
      
    Until Event = #PB_Event_CloseWindow
    
  Else
    Debug "Dialog creation error: " + DialogError(#Dialog)
  EndIf
  
Else
  Debug "XML error on line " + XMLErrorLine(#Xml) + ": " + XMLError(#Xml)
EndIf
xml

Code: Select all

<?xml version="1.0" ?>
<!-- Window -->
<window flags="#PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget" id="0" minheight="auto" minwidth="auto" name="Test" text="Test">
	<hbox>
		<string name="name" text="string" flags="#ES_CENTER"/>
	</hbox>
</window>
Torp
User
User
Posts: 82
Joined: Fri Apr 01, 2005 11:29 am

Re: Justify StringGadget and Dialog Library

Post by Torp »

Any news ? :)
falcon
New User
New User
Posts: 5
Joined: Tue Jan 24, 2017 7:21 am

Re: Justify StringGadget and Dialog Library

Post by falcon »

I agree, having the ability to right justify the text in a StringGadget would be very useful.

Also, if a TextGadget has an attribute of "Single Line", the text in the TextGadget should be centered vertically.
Post Reply