[Gambas-devel] Creating a Control

John Leake jleake at ...741...
Wed Sep 10 11:41:40 CEST 2014


Hi Tobias,

Thank you for your response.

I am simply trying to improve the user experience while I can still see
things from a newbies perspective.

Not all users find writing code fun.  Many have a problem to solve or
wish to make boring or time consuming actions less so.

Surely the Gambas community want to expand their user base !

>  1. Create a form named F##A (you know the C preprocessor's token paste
>     operator, right?),
>  2. Arrange the controls you want A to be made of on the form (the good
>     thing is that you can design this by using the IDE's Form editor),
>  3. Wire the controls' actions together in the Form's class file,
>  4. Create properties, methods and events for your purpose in F##A,
>  5. Create your actual class A which is Export'd and Inherits UserControl.
>     You create an instance of F##A on yourself in the constructor of that
>     class (since you inherit UserControl, you can create controls on your
>     own surface and a Form can be created as a container on a window, too,
>     not only as a top-level window),
>  6. Expose the needed parts of F##A's interface to public through the
>     interface of your exported class A,
>  7. Do the IDE integration stuff, i.e. draw an icon and set the public
>     constants which govern IDE integration, in A.
> 

Wouldn't the following be more preferable (from a users perspective) ?

1) Create a new 'control project'.
2) Drop a ToggleButton into it.
3) When tested, click 'publish' to add the control to Gambas toolbox.

> I think it's normal
> if it takes you a while to get to grips with it as I consider custom control
> creation an advanced topic. 

Not all users are programmers. When you use a system for the first time
the process should be intuitive and just work with minimal effort.
Newbies are like children, they learn best by trying things out and
following the visual clues that they are presented with and look at the
results. Kind of like a picture makes a thousand words.

> But it's beautiful to do with Gambas.

I agree.  My intention is to improve the newbie experience.

> If you have any questions, don't hesitate!

Thank you.

> 
> [ You *will* also want to explore the automatic layouting capabilities of
>   Gambas, if you don't already have experience with it from other languages.
>   You will see that the FMain in my project is full of containers like HBox
>   and VBox. These arrange their children in special ways. The key properties
>   to look at here are: Arrangement, Expand, Margin, Spacing and sometimes
>   AutoResize. Take a weekend or so off (judging from my own experience) to
>   experiment with these and how a wrong setting can mess up everything :-)
> 
>   To get motivated: arrange some controls on a Form, run your project and
>   resize the Form -- not very pretty. Now resize the window in my project. ]
> 

This complicated area also needs to be looked at.

Ever checked out 'slots' an 'stacks' written by Why ?

What about the default behaviour wouldn't it be much better if it
behaved like 'CodeFlower' ?

This is another thing I would like to introduce.

My experience as a software engineer has spanned hardware and software
design in the field of real-time embedded systems, right through to
large scale business systems consisting of in excess of 12,000 source
files and 25+ developers.  The more sophisticated dev envs automatically
generated docs, tests, diagrams, performance profiles and god knows what
else.  They also cost £50k / seat and were useless when put in front of
a newbie.  Things need not be like this.

Again, I am just trying to give something back to the open source
community and remove barriers for newbies.

If I could not figure out from the documentation how to create a custom
control then what chance do newbies have if they possess little or no
experience at all ?

> Note that you are talking about IDE integration here (right?). You can write
> 
> --8<--[ MyToggleButton.class ]----------------------------------------------
> ' Gambas class file
> 
> Inherits ToggleButton
> --8<------------------------------------------------------------------------
> 
> and the interpreter will be happy and everything will be there. Integrating

May be the documentation should reflect that.

> I don't see yet why it is
> so important to make it require even less effort. Maybe you've got real
> world experience here [ heck, you've worked longer as a developer than I am

> alive :-) ], but I deem custom controls to be a thing which newbies should
> stay away from.

Should they be excluded by technical jargon or have to read reams of
documentation and learn strange (to them) concepts ?

> PS: I insist on keeping gambas-user CC'd :-P

Sorry what is this ?

Best regards,
John




More information about the Devel mailing list