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

Bruce Steers bsteers4 at gmail.com
Wed Mar 29 17:17:40 CEST 2023


On Wed, 29 Mar 2023 at 14:04, Bruce Steers <bsteers4 at gmail.com> wrote:

>
>
> On Wed, 29 Mar 2023 at 12:48, Bruce Steers <bsteers4 at gmail.com> wrote:
>
>>
>>
>> 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
>>
>
> Or completely customize your gambas IDE like I did mine, as it's written
> in gambas,,,,,, and we know gambas ;)
> I added a component loader in the IDE preferences.
> In the attached pic you can see it working for my ButtonFrame container.
>
> (and note, i give plenty of warnings about the risks, and potential bugs)
>
> gotta love Gambas :)
>
> So Benoit, you still not interested in adding anything like this to the
> IDE?
> Maybe a way the IDE can load/reload custom components (custom controls
> going through some extra error handling n stuff i guess.
>

Darn, It seems after the recent  "do not apply properties" commits my
component loader does not actually work any more :'(

Well it was nice while it lasted :)

Looks like I might have to start settling for _DrawWith too :-\

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


More information about the User mailing list