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

Claus Dietrich claus.dietrich at freenet.de
Thu Mar 30 16:36:30 CEST 2023


Am 29.03.23 um 13:48 schrieb Bruce Steers:
> On Wed, 29 Mar 2023 at 12:33, Claus Dietrich 
> <claus.dietrich at freenet.de> wrote:
>
>     My question: How can a custom UserControl be rendered during
>     development time so that it looks similar to its appearance at
>     runtime?
>
> 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

Hi Bruce,

Thanks, this was really helpful. As suggested I am now using

Public Const _DrawWith As String = "Button"

which is an acceptable compromise for a "preview" to me. To make a 
component out of it and install it seems to be the ultimate solution, 
but for this the class must be in a final version and I would need to 
figure out, how such a component can be installed.

Best regards

Claus






More information about the User mailing list