PxPlus User Forum

Twitter Twitter Twitter

Author Topic: draw button as empty rectangle  (Read 1612 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
draw button as empty rectangle
« on: January 09, 2019, 10:17:38 AM »
I want to create a button with my own program logic (not nomads). What is necessary to make it look like an empty rectangle?

btnCcl= 10501
button btnCcl, @(10, 10, 10, 1.5)="&Cancel",opt="F"
btnCcl'borderColor$ = "DARK GRAY"
btnCcl'hoverTextColor$ = "WHITE"
btnCcl'hoverBackColor$ = "DARK GRAY"

I'm missing the border.

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 280
    • View Profile
    • PVX Plus Technologies
Re: draw button as empty rectangle
« Reply #1 on: January 09, 2019, 11:20:43 AM »
I expect you're looking for the 'border$ property:
https://manual.pvxplus.com/page/properties/border_.htm
« Last Edit: January 09, 2019, 11:25:53 AM by Jane Raymond »
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: draw button as empty rectangle
« Reply #2 on: January 10, 2019, 01:43:19 AM »
Thank you. That's it.

btnCcl= 10501
button btnCcl, @(10, 10, 10, 1.5)="&Cancel"
btnCcl'border$ = "Solid"
btnCcl'borderColor$ = "DARK GRAY"
btnCcl'hoverTextColor$ = "WHITE"
btnCcl'hoverBackColor$ = "DARK GRAY"

I wonder, if there is a way to apply the current theme/VC to such a self drawn control.

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 280
    • View Profile
    • PVX Plus Technologies
Re: draw button as empty rectangle
« Reply #3 on: January 10, 2019, 11:37:22 AM »
The application of theme/visual class attributes to controls is rather entrenched in the Nomads logic. You would have to set up a number of variables (as if you had read a record from the screen library file), and then perform the *winproc.dfs program to get the new settings, then you would have to apply all the settings. I expect it would just be easier to use controls on a Nomads panel.
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: draw button as empty rectangle
« Reply #4 on: January 10, 2019, 11:56:21 AM »
If what you are looking for is to dynamically control the presence of the control, just put the button in your Nomads panel but make it hidden. When you need it simply make it visible. 

If you need to dynamically control its location, change its size/position prior making it visible since Nomads generally doesn't care about button positions.

Another option would be to again create a hidden button whose characteristics are based on a theme.  When you want to create your dynamic button simply copy the border and color properties from the hidden button to the button you are creating.  Something like:

ThemeSettings$=hidden_btn.ctl'border.borderColor.hoverTextColor.hoverBackColor.$
...
btnCd'border.borderColor.hoverTextColor.hoverBackColor.$-ThemeSettings$


This will just copy the attributes from the hidden button to the dynamic button.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com