Page 1 of 1

Justify StringGadget and Dialog Library

Posted: Thu Aug 29, 2013 12:16 pm
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

Re: Justify StringGadget and Dialog Library

Posted: Thu Aug 29, 2013 12:21 pm
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.

Re: Justify StringGadget and Dialog Library

Posted: Thu Aug 29, 2013 12:54 pm
by Fred
For now, you can declare these constants as "Runtime" and then use it in the XML flags.

Re: Justify StringGadget and Dialog Library

Posted: Thu Aug 29, 2013 5:37 pm
by Torp
Arf, I did not understand all the subtleties of Runtime :?:.

Re: Justify StringGadget and Dialog Library

Posted: Thu Aug 29, 2013 5:40 pm
by Fred
in your code before loading the XML dialog:

Code: Select all

Runtime #ES_CENTER
the you can use it in the XML.

Re: Justify StringGadget and Dialog Library

Posted: Fri Aug 30, 2013 8:53 am
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>

Re: Justify StringGadget and Dialog Library

Posted: Thu Sep 12, 2013 11:37 am
by Torp
Any news ? :)

Re: Justify StringGadget and Dialog Library

Posted: Sun Oct 01, 2017 6:44 pm
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.