B4J Question Making CheckBox text appear on its left side

MegatenFreak

Active Member
Licensed User
Hello.
I'm having checkboxes with Farsi text which is a right-to-left language. So, naturally, a checkbox should appear on the right side of its text, and everything must be aligned to the right. I've been playing around with CSSUtils and direct style properties without success.
Can anyone please help me with this?
Thank you so much in advance.
 

derez

Expert
Licensed User
Longtime User
If you can't find a way to change it make your own view with a minimal size checkbox (without text) and a label to the left of it.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
You can use the same solution as you found on your Combobox question, just change Combobox to Checkbox.
 
Upvote 0

Alain75

Member
It's an old thread and certainly problem got a solution :) But I recently had the same problem because I wanted to center checkbox in a rectangle. As I didn't want to create manually a panel for each checkbox, I created a new class, XCheckbox, which supersedes Checkbox.

To use it, simply add the class in your application:
Sub Globals
    Private CHK As CheckBox
    Private CHK2 As CheckBox
    Private CHK3 As CheckBox
    Private XCHK,XCHK2,XCHK3 As XCheckbox
    ...
End Sub

Sub Activity_Create(FirstTime As Boolean)
    XCHK.Initialize(CHK)
    XCHK2.Initialize(CHK2)
    XCHK2.Initialize(CHK3)
    ...
End Sub

Sub xxx
    ...
    If CHK.Checked And ... then ...
    XCHK2.mLabel.Text = "New label for CHK"
    ...
End Sub

Example for 3 different initial checkboxes :


Note : there is a conditional statement in the file because I use a library for all my development.
 

Attachments

  • XCheckbox.bas
    1.5 KB · Views: 78
Upvote 0
Top