Integrated Application Platform › Forums › General › How to show left text for boolean field control?
- This topic has 4 replies, 2 voices, and was last updated 8 years, 8 months ago by jaska_lee.
September 10, 2014 at 1:38 am #791
I would like to show the text on the left of the checkbox for boolean fields on access. But the left text option for boolean field control doesn’t seem to be working. It works if you directly add a checkbox,
Window(#(CheckBox 'Allow Bonus' lefttext:))
But it does not show lefttex for boolean controls defined for table fields.
ThanksSeptember 10, 2014 at 5:33 pm #1107amckinlayKeymaster
It is a result of Control.Construct and how it uses CheckBoxPairControl.
It probably would not be too hard to fix CheckBoxPairControl to handle it.
(it doesn’t help you, but this has changed in my latest code and now works correctly)September 11, 2014 at 2:35 am #1108
thanks andrew, I have modified two standard objects and it now seems to be working as I expected.
Following changes make the text show on the left for CheckBox control.
New(prompt, checkbox, hidden = false) // old: (checkbox, prompt, hidden = false)
super(.layout(prompt, checkbox, hidden)) // old: (checkbox, prompt, hidden)
c = .Horz.GetChildren()
//.box = c
//.text = c
//.Ymin = .box.Ymin
//.Top = .box.Top
.text = c
.box = c
.Ymin = .text.Ymin
.Top = .text.Top
layout(prompt, checkbox, hidden) //old: (prompt, checkbox, hidden)
text = Object('Static', prompt, notify:, hidden: hidden)
for m in #(font, size, weight)
text[m] = checkbox[m]
//old: return Object('Horz', checkbox, #('Skip', 3), text)
return Object('Horz', text, #('Skip', 3), checkbox)
2) Construct method in Control object
On Access control, I could not make the text align with the rest of the textboxes. But if I comment out the code concerning ‘prompt isn’t greyed’ for CheckBox, it aligns with others nicely and prompt isn’t greyed in protect mode. Is it safe to do it like this?
if (x.Size() is 1 and x.Member?(0) and Object?(x))
x = x
if (x is 'NoPrompt' and String?(x) and x =~ "^[_a-z]")
c = x
x = Datadict(x).Control.Copy().Add(x at: 'name')
for m in c.Members()
x[m] = c[m]
else if (String?(x) and x =~ "^[_a-z]")
name = x
dict = Datadict(name)
x = dict.Control.Copy()
hidden = false
if .Custom isnt false and .Custom.Member?(name)
hidden = .Custom[name].GetDefault('hidden', false)
x.name = name
if "" isnt prompt = Prompt(name)
//if x is 'CheckBox'
//x = Object('CheckBoxPair', x, prompt, hidden: hidden)
// need this so prompt isn't greyed when protected
x = Object('Pair', Object('Static', prompt, hidden: hidden), x)
_parent = this
_ctrlspec = x
ctrl = Construct(x, "Control")
if (ctrl.Name > "")
this[ctrl.Name] = ctrl
}September 11, 2014 at 7:57 pm #1109amckinlayKeymaster
The other reason for CheckBoxPair is to get a focus rectangle on the prompt.
When CheckBoxPair draws the text it handles the focus rectangle, but then it grays out the text when protected.
If you use Pair (like in your changes) then Static draws the text so it is not grayed out, but you do not get a focus rectangle.
Note: With your changes to Control.Construct, CheckBoxPair is not used any more.
If you made your changes to CheckBoxPair but did not change Control then it should work as before.September 12, 2014 at 3:04 am #1110
if I don’t make the change to construct method, it goes like this(please see the screenshot) and i couldn’t get it align with the rest textboxes.
i see the point of using ‘CheckBoxPair’, however, i actually prefer no rectangle on prompt when clicked.
thanks for the tips andrew.
- You must be logged in to reply to this topic.