Left-Justify BUTTON Text

Started by steezware, November 06, 2024, 06:18:49 PM

Previous topic - Next topic

steezware

Not sure if this is a Nomads or a Language issue, but...

Is there built-in Pvx logic or maybe a trick to have the 'text on a BUTTON control left-justified?

martinp

I don't think you can with the dynamic properties ' 

you could add btn.ctl'text$=PAD("Ok",10)  some spaces ...

What are you trying to do exactly.

steezware

Yep, expression PAD(" Button Text", 2400) works great ... until you resize the panel, then Nomads (or someone) moves the text over from the left.

What I am trying to do is display button text left-justified, it's that simple.

martinp

So on the nomads panel itself you can set the button to have text left justfied in the font section of button.

Loren Doornek

Check the manual page for the OPT= options for a BUTTON at:

https://manual.pvxplus.com/PXPLUS/directives/button.htm#Mark4

There are some caveats discussed there, such as the need for 3D or 4D if using button images.  In Nomads, there is a radio button on the Font screen, but that might not work if you don't 3D enabled.

steezware

I now see I wasn't clear enough. Of course I can justify an IMAGE to the left, right, top or bottom of the button text, but my button has no image. And regardless of the image-justification setting the text is still centered on the button.

So, what I'm looking for is a way to left-justify text on a button that has no image.

James Zukowski

In NOMADS, on the Font/Clr tab, you can select whether the text is Left/Center/Right justified.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

martinp


steezware

Got it - thx! :)

My client is on an older version of Pvx/Nomads and those options do not exist.

I checked the online manual and it does, indeed, mention font alignment under the Nomads section, but does not note when that feature was added to  PxPlus...

https://manual.pvxplus.com/PXPLUS/NOMADS%20Graphical%20Application/Creating%20Panel%20Controls/Button%20Control/Overview.htm

...and also in the online manual, for button properties there is 'BitmapPosition but nothing about a font-position property...

https://manual.pvxplus.com/PXPLUS/control_object_properties/button_properties.htm

Again, thank you to Martin and James and others for sharing this information with me.



James Zukowski

In the online manual, the entry for the BUTTON directive includes the option for a FNT= specification, with details in the 'FONT' mnemonic. For things to work, it seems you also have to include OPT="A" and use the '4D' mnemonic. E.g.:

print '4D',
B_ID=100
button B_ID,@(10,5,10,3)="Click Here",opt="A",fnt=",,R"

While you can specify the justification when creating the button, it seems you can't change it, though you can retrieve and change other font attributes:

F$=B_ID'Font$
B_ID'Font$="Courier New,-18,B"

Overall, to left-justify the text, all you need to include when manually creating a button is to include the OPT="A". Not sure what you can do with old NOMADS...
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services