TickBox a custom CheckBox
Posted
#1
(In Topic #599)
Guru

Have spent ages on this blooming thing.
It's not the easiest thing to make a custom checkbox control.
well making it was pretty straight forward but then getting it to look how a normal checkbox looks on gtk2+3 and QT took days of tweaking and experimenting/testing.
How it is different…
TickBox1.TextPosition = Align.Left ' put the text to the left not the right.
TickBox1.Picture = picture ' use ANY image you want as the check mark (default is the stock "apply" image)
TickBox1.BoxBackground = ColorInteger ' set the background colour of the checkbox
Box/check image size will grow to font height
Here it is alongside some normal checkbox's
(attachment removed)
It still needs a tweak or 2 with spacing n stuff and on QT if you resize the form they all jump left a pixel or 2 for some reason but it seems harmless.
And when the text is to the right the box seems too far left, no padding and a bit of a gap between the box and the text, i'll work on it.
Have fun
Posted
Guru

<VIDEO content="http://bws.org.uk/images/screenrecord-2021-02-28_15.57.18.mp4">[video]
Posted
Enthusiast

Posted
Guru

PJBlack said
TickBox.class 66 MakeLabel(): .Centered is not a property
Doh bugger it's not backward compatible
i forgot to test it on other gambas versions sorry
that's a quick fix by putting "Try" before the .Centered command on line 70
Try .Centered = True
but it might mess up the layout on older gambas and i'll have to do it manually,
thanks for letting me know.
I'll update the above file…
Posted
Expert

Wrote a class to do all the grunt work and it worked perfectly but in the end, I found that a multi select list box does the same thing
for much less work. I can point it at a data table and a reference table that has boolean values and it just works.
I'm a more pedestrian programmer. I write things that I need to do practical stuff and not 'tinker under the hood' too much.
Nice to see what the tinkerers are up to though.
Cheers - Quin.
I code therefore I am
I code therefore I am
Posted
Guru

Quincunxian said
I did this a while ago with a scrollview and child checkboxes as I missed the checked list box of vb.net.
Wrote a class to do all the grunt work and it worked perfectly but in the end, I found that a multi select list box does the same thing
for much less work. I can point it at a data table and a reference table that has boolean values and it just works.
I'm a more pedestrian programmer. I write things that I need to do practical stuff and not 'tinker under the hood' too much.
Nice to see what the tinkerers are up to though.
sounds cool
I've almost tinkered this into perfection now
Posted
Guru

seems okay now.
only issues are…
is it does not quite operate AutoResize like gtk does on gambas 3.12 but does on 3.15
and the box has a position glitch it qt on gambas 3.15 not 3.12 where it's a little too far right then jumps into correct position on window resize.
and i was so close to perfection
BruceS
Posted
Enthusiast

left is GTK and right is QT5 … different look different behavior … call me old shool but qt right panel is what i aspect to get …
i found one or two (besides the jumping qt labels) very little unbeautiful missbehaviour … the original check box will change background on mouseenter and restore on mouseleave … on mouse down the checkbox is highlighted and the checkmark is set and on mouseup the highlight is unset … your checkbox will not highlight background on mouseenter/leave and will not set checkmark on mousedown but on mouseup … and the labeltext is highlighted (again call me old shool …) but is forgotten to unset on mouseleave/lostfocus …
you can call me "Korinthenkacker" (dict.leo.org says: inch pincher or nitpicker/nit-picker)
btw. love your progs
Posted
Guru

I may just have to state , well it's not the gtk checkbox or the qt checkbox , it's the tickbox
Posted
Enthusiast

BruceSteers said
i'll make one small change that will make it all perfectly fall into place![]()
congratulations … if i make a small change everything turns into deepest dysfunctional bullshit … so … usercontrol development is pure fun and soooo easy they said …
1 guest and 0 members have just viewed this.



