[lazarus] Progress

Shane Miller smiller at lakefield.net
Wed Sep 1 16:52:07 EDT 1999

>Shane Miller wrote:
>> Actually, you can create new "events" for the components simply by
>> using the DISPATCH method.  For example, in my code I may need to
>> detect a "move mouse right" event and a "move mouse left" event.  So
>> in my code I create a const
>> then in the mouse move event (that gtk sends) I track and detect if it
>> is moving right or left.
>> If moving_right then
>>     Dispatch(LM_MOVEMOUSERIGHT)
>> else
>>    Dispatch(LM_MOVEMOUSELEFT);
>> in the component, obvoiusly I will have a
>> Procedure MoveRight(var msg); message LM_MOVEMOUSELEFT;
>> etc.
>> In that procedure I do a
>> If Assigned(SomeProcedure) then
>>   Someprocedure(sender);
>> So, to the user of that component it appears to have a movemouseleft
>> and movemouseright event.
>> This will not be easy for very complicated events, but that's how it's
>> done.
>But this works if and only if the current component fires a callback for
>a mousemove event. If the component doesn't support that then there is
>no way to add the mousemove event to the GTK component. That is the
>point I am trying to make everyone understand. If the event isn't
>already supported by the component (and I am not talking about the user
>designed event like above) which will deliver a callback then you can't
>add the event. The only way to add it would be to modify the "C" code in
>the GTK library.

Ttrue, however we this is exaclty the same for window.  If it doesn't handle
an event by defualt you can't force it to.  I remeber there's a widget that
detects the mouse move, clicks, etc that is invisible and it's meant to be
used to add this functionality to components that don't have it by defualt.
We could look into adding that to all widgets that need it.

>> Think about it, if you create a component that extends itself off of
>> TBUTTON and want to add events that aren't handled by default, you
>> have to do a dispatch or call a procedure manually.
>Exactly what do you think you could call to get the GTKMain event loop
>to recognize and send a callback for an event it wasn't designed to

GTKMAIN wouldn't receive the info.  The new/user defined events would be
called and handled in the component, not in gtk.

Let's not get hung up too far on this.  Let's get something that works and
if we need to change something we will have a better idea how to do it once
we get a larger base of WORKING code.  Otherwise, we'll never end up with

Let's get all the components added that gtk handles, get an editor up and
running, and get something that we can show.


More information about the Lazarus mailing list