[Gambas-user] _DrawWith Me ? trying to view custom controls in the IDE

Benoît Minisini g4mba5 at gmail.com
Sat Feb 20 17:37:24 CET 2021


Le 20/02/2021 à 15:03, Bruce Steers a écrit :
> 
> 
> On Sat, 20 Feb 2021 at 06:42, Bruce <adamnt42 at gmail.com 
> <mailto:adamnt42 at gmail.com>> wrote:
> 
>     On 20/2/21 3:13 pm, Bruce Steers wrote:
>      > I'm chugging away chewing on making a custom control.
>      >
>      > I call it Tickbox
>      > It's a CheckBox but uses a picture for the tick and can set text
>     to left or
>      > right.
>      >
>      > My discovery though that's a bit naff...
>      > Unless i add the control to gb.form and compile it in it's not
>     very good to
>      > use.
>      >
>      > I'm sure you know what i mean.
>      > _DrawWith works great for a copy of an existing control in
>     displaying it
>      > but not a new one.
>      >
>      > something like _DrawWith = "Me" would be good.
>      >
>      > If i copy the class into gb.form source folder and compile it
>     then works
>      > all as expected.
>      >
>      > The 2 attached snapshots is what i refer to. one shows the
>     control as a
>      > class but in the normal gambas, te other where i've added the
>     control to
>      > gb.form.
>      >
>      > Is there nothing can be done to get the custom controls visible?
>      > i've had to make a branch and have a custom gb.form to work with
>     and keep
>      > installing/reinstalling just to get the control useable (in the IDE).
>      > the control works and shows fine when i launch the app, it's just
>     the IDE
>      > won't play ball :(.
>      >
>      > Thanks for any pointers if i'm missing something.
>      >
>      > BruceS
>      >
>      >
>      >
>      > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>      >
> 
>     I doubt it. We had a go some years back and it proved to be not worth
>     the effort. The way the Form Designer handles DrawWith I now cannot
>     recall. Most times we just use the nearest enclosure box to give some
>     idea as to the custome control content. YMMV but giventhe "elasticity"
>     of the form designer vs the form as displayed at runtime I found more
>     value in getting the control's "working code" right rather then how it
>     looks in the form designer.
> 
> Darn it.
> i may have to delve into the _DrawWith code myself and see if i can have 
> any revelations.
> can't help but think there must be a way...
> Had a hunt through the code ...
> Seems to run through CDocumentation.class and CComponent.class, i guess 
> hardcoded to use the default dirs in /usr and not get all the info from 
> project dir (just the icon).
> this is worth more investigation/study i think. would be a certain 
> upgrade with gambas if the IDE could get DrawWith info from the project 
> dir and render custom controls properly as you create them.
> I'm thinking along the lines of being able to set _DrawWith = "TickBox" 
> for my TickBox.class and the IDE finding TickBox in the project dir and 
> work from there. (much like it does with _Properties Const string)
> 
> Thinking is one thing though ,, doing is going to be a challenge that I 
> foresee a day or 2 disappearing for me lol
> Thanks for the info bruce :)
> 
> 
>     Nonetheleless it's good to see someone else that wants a left labelled
>     checkbox. We also have a left labelled radiobutton. I don't know how or
>     why the idea of right labelling these things became a "design standard"
>     but ISMTT! (Work that one out by yourself).
> 
> 
> to be fair it was somebody else's suggestion on here "a good place to 
> start is make a checkbox with left handed text"
> seemed a fair suggestion and a good point that checkboxes only put text 
> on one side.
> then i took a shine to the idea of also being able to use any custom or 
> stock image for the check.
> 
> Just would be nice to see it in the ide without having to integrate it 
> into gb.form
> I made a new component gb.form.bonus in /comp and installed it but that 
> didn't work with DrawWith either, only option i got is gb.form it seems.
> 
> Benoit , any views / interest in getting this feature working, or is it 
> like many of my other thoughts that would be a simple change that turn 
> out to actually be a hugely complicated change?
> Would be a boost in the custom control creation department i think.
> 
> Many thanks
> Wishing well
> BruceS
> 
> 

The IDE will not render custom controls as is, because it won't load 
their component. The "_DrawWith" constant allows you to use a similar 
control that must exist in one the component loaded by the IDE 
(gb.form). Otherwise let the IDE draw the custom control with its icon 
inside a frame.

Regards,

-- 
Benoît Minisini


More information about the User mailing list