B4J Question CheckBox comes off name

red30

Well-Known Member
Licensed User
Longtime User
The place where the check box is always oriented to the left. How can I make it so that the checkmark is centered along with the inscription?
As the picture below

CheckBox.png
 

sorex

Expert
Licensed User
Longtime User
make the width smaller, use CENTER-LEFT alignment and reposition the left to slidercenter-(checkbox.width/2) ?
 
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
I registered the place of the element in the script. So that he always remains in one place when changing the window.
B4X:
chb1.Left=1%x
chb1.Top=0%y
chb1.Width=16%x
chb1.Height=5%y
I wanted him to be always in the center. But if I put the text argument center, then the window itself for a check box leaves to the left. I want the check box and the text to be always in the center.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
the width can be fixed. you just need to set the .left based on your center position (the slider.left + slider.width/2)
 
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
the width can be fixed. you just need to set the .left based on your center position (the slider.left + slider.width/2)
If I do this, I will always get this:
B4X:
chb1.Width=16%x
chb1.Left=1%x+chbn1.Width/2
chb1.Top=0%y
chb1.Height=5%y

chbx10.Width=6%x
chbx10.Left=9%x+chbx10n1.Width/2
chbx10.Top=30%y
chbx10.Height=5%y
CheckBox2.png
 
Last edited:
Upvote 0

red30

Well-Known Member
Licensed User
Longtime User
What about uploading a small project which shows the issue?

No one can help you just by seeing the Snapshot.
Yes, it will be clearer.
When I change the size of the form, the inscriptions of the checkboxes always remain in the center, and the rectangle where you need to put a check mark always remains on the left. How can I make everything centered?
 

Attachments

  • testchb.zip
    2.4 KB · Views: 132
  • 1.png
    1.png
    15.2 KB · Views: 144
  • 2.png
    2.png
    17.6 KB · Views: 138
Upvote 0

sorex

Expert
Licensed User
Longtime User
B4X:
'chbx10n1.Width=30%x
chbx10n1.Width=50
chbx10n1.Left=(sldn1.Left+sldn1.Width/2) - chbx10n1.Width/2
chbx10n1.Top=70%y
chbx10n1.Height=10%y


I don't know where you exactly want the other one positioned.
 
Upvote 0
Top