[Gambas-user] Rendering of Custom UserControls during development time

Bruce Steers bsteers4 at gmail.com
Wed Mar 29 13:48:09 CEST 2023


On Wed, 29 Mar 2023 at 12:33, Claus Dietrich <claus.dietrich at freenet.de>
wrote:

> Am 24.03.23 um 16:30 schrieb Benoit Minisini:
>
> Look at the documentation and at the source code of the SwitchButton
> control (for example) in the 'gb.form' component for more details.
>
> Native Gambas UserControls like Buttons are rendered almost exactly the
> same during development time as during runtime. That means i.e. that a
> Button displays a loaded Picture already during development time. This does
> not apply for self-made controls implemented as class. In that case only a
> simple box or an icon loaded from the Project/control - directory is
> displayed. This also applies to native Gambas controls if implemented as
> class. I tested it with the source code of the Gambas SwitchButton.
>
> My question: How can a custom UserControl be rendered during development
> time so that it looks similar to its appearance at runtime?
>
> Best regards
>
> Claus
>

the IDE can only show components it loads when it first runs.

If that makes sense.
you component is a part of your project loaded by gambas , not a part of
gambas.

I made a way to load my controls but it meant hacking the IDE in a way that
Benoit does not like and is reluctant to implement.
This is because the controls are loaded by gambas into the IDE itself and
their code to render in the IDE is part of the component, a custom control
that is not coded properly can break gambas.

Plus it gives many other issues especially if you are working on the
control.  as you will make changes to it but the IDE cannot reload the
already loaded control. so you get glitches that resolve when closing
gambas and re-opening it.

you best option is to use _DrawWith that will use an official control as
your preview.
eg.

Public Const _DrawWith As String = "GridView"

will show your control as a gridview in the IDE

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230329/bb9140d5/attachment.htm>


More information about the User mailing list