[Gambas-user] Write a new component: Firmata (Second attempt)

Benoît Minisini g4mba5 at gmail.com
Tue Mar 27 17:16:06 CEST 2018


Le 27/03/2018 à 17:03, Matias De lellis a écrit :
> 
> I attach a test version of the component. It has a Led class - Which is 
> literally a copy of 'SwitchButton' - which is shown in the toolbar, but 
> when I put the control on the form, I can not get it to show the Switch. 
> It show the component icon.. :disapointed:

The IDE can only display the controls it uses itself. For every other 
control, it will display a frame with the control icon inside (it does 
not know how to draw the control).

Otherwise, you can define the "_DrawWith" constant to tell the IDE which 
standard control it can use instead to draw the new control.

I don't want the IDE to dynamically load components just to draw them, 
because it's a security risk, and a potential source of errors.

> 
> Please.. keep in mind that it is just an example, I do not want to show 
> the SwitchButton. I want to draw a led considering a color, and this 
> seemed like a good starting point... :wink:
> 
> Can you please check if I'm missing something?
> 
> p.s:
> 2nd doubt: Is there any way to install the component for the user to 
> test.? $home/.local/gambas??

No. You can do that with library projects, not component projects.

See components like what device drivers are for the Linux kernel.

If your control is well written, we can put it in the 'gb.form' 
component. That way, the IDE, as it uses that component, will be able to 
draw it.

Regards,

-- 
Benoît Minisini


More information about the User mailing list