[Gambas-user] Select an entry in a combo or list box by keypress - Is there a better way.

Kari Laine klaine8 at ...626...
Sat Sep 13 15:41:25 CEST 2008


On Sat, Sep 13, 2008 at 4:15 PM, Benoit Minisini <
gambas at ...1...> wrote:

> On samedi 13 septembre 2008, Ian Roper wrote:
> > It would be nice to have this as a standard method for these sort of
> > controls. :)
> >
>

Hi Benoit,
I am here learning Gambas...I have some questions - don't answer if you too
busy with improving Gambas :-)



>
> You can actually do that easily in your own projects by reimplementing
> these
> controls.

Could you write little more about this reimpiementing controls? I don't
understand it at all :-(
So if you make a class with a same name as the control it get's instantiated
first - how then it is connected to the standard control - by the observer?



>
>
> For example, for the ListBox, creates a "ListBox" class in your project,
> and
> put that in it:
>
> --8<-- ListBox.class ----------------------------------------------
>
> EXPORT

Why is this EXPORT needed?



>
>
> PRIVATE $hObserver AS Observer
>
> PUBLIC SUB _new()
>
>  $hObserver = NEW Observer(ME) AS "ListBox"
>
> END

Could you explain once and for all this observer-thingy. I know there is
something like that in C# and Java but I never understood it properly. Does
it have something to do with observer design pattern - which I also don't
understand as of yet.

How events propagate when you have this own ListBox-class. They first go to
your class but how the real thing is connected?


Sorry for stupid question which might be obvious...

Best Regards
Kari Laine




>
> PUBLIC SUB ListBox_KeyPress()
>
>  ' Put your code there
>  ...
>
> END
>
> PUBLIC SUB ListBox_LostFocus()
>
>  ' Put your code there
>  ...
>
> END
>
>



More information about the User mailing list