Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
107 user(s) are online (75 user(s) are browsing Forums)

Members: 0
Guests: 107

more...

Headlines

 
  Register To Post  

Tabbing away from a MUI String gadget - any way to get an event?
Home away from home
Home away from home


See User information
I have a notification event set on MUIA_String_Acknowledge for my String gadgets, which means I get an event when the user presses Enter. The problem is that if the user just Tabs to the next String gadget, then I never get any event, and so the old String contents is still used.

So, is there any way to get an event on Tab? Preferably without a custom class.

Currently my best idea seems a bit kludgy & tricky: Get notified when MUIA_Window_ActiveObject changes, store the new object, then *somehow* check if the previous object was a string (any suggestions?), and if so then generate a fake MUIA_String_Acknowledge event for it.

Author of the PortablE programming language.
Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Just popping in
Just popping in


See User information
There is no other way than subclassing. Just watch out for MUIM_GoInactive. This method will be called whenever the active object becomes inactive for whatever reason: TAB, mouse click, etc.

Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Home away from home
Home away from home


See User information
@tboeckel Quote:
There is no other way than subclassing.

Not the answer I wanted to hear, but thanks for the confirmation.

But are you SURE my "best idea" isn't workable? It seems to me it would work if I can determine the parent object (class) of the active object. I presume that should be possible via some BOOPSI magic (if I had a clue).

Author of the PortablE programming language.
Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Home away from home
Home away from home


See User information
@tboeckel
Or if BOOPSI lacks class identification, then I can always use a hash-table to store all known string objects...

Author of the PortablE programming language.
Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Just popping in
Just popping in


See User information
Quote:

ChrisH wrote:
@tboeckel Quote:
There is no other way than subclassing.

Not the answer I wanted to hear, but thanks for the confirmation.


What's wrong with subclassing?

Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Home away from home
Home away from home


See User information
@Slash Quote:
What's wrong with subclassing?

I've never done it with BOOPSI/MUI stuff, and I don't understand BOOPSI's object model. Possibly I can do it by copying & pasting an example (without really understanding), but they seems like a reciepy for disaster (e.g. my blind copying of DoPkt3() code to detect soft/hard links didn't work reliably).

Author of the PortablE programming language.
Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Home away from home
Home away from home


See User information
@tboeckel Quote:
Just watch out for MUIM_GoInactive

I decided to have a quick go, just to see how difficult or not this might be using a custom class... but I quickly ran into a problem:

MUIM_GoInactive does not exist in my public MUI headers. Since this solution is suppose to work on OS3.x (and clones), I guess this means your solution isn't workable

Author of the PortablE programming language.
Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Home away from home
Home away from home


See User information
I wrote Quote:
Currently my best idea seems a bit kludgy & tricky: Get notified when MUIA_Window_ActiveObject changes, store the new object, then *somehow* check if the previous object was a string (any suggestions?), and if so then generate a fake MUIA_String_Acknowledge event for it.

This is the solution I am now using. But rather than query BOOPSI for the object's type, I just store all known MUI String/Text/etc objects in a hash table. As this is all handled by PortablE's GUI generation system, it's no hassle.

But I'd still be interest to know (if possible) how to find the parent object (aka "class") of a BOOPSI object.

Author of the PortablE programming language.
Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Home away from home
Home away from home


See User information
@ChrisH


From intuition/class.h


/* convenient typecast */
#define _OBJ(o) ((struct _Object *)(o))

/* get "public" handle on baseclass instance from real beginning of obj data */
#define BASEOBJECT(_obj) ((Object *)(_OBJ(_obj)+1))

/* get back to object data struct from public handle */
#define _OBJECT(o) (_OBJ(o) - 1)

/* get class pointer from an object handle */
#define OCLASS(o) ((_OBJECT(o))->o_Class)

Go to top
Re: Tabbing away from a MUI String gadget - any way to get an event?
Just popping in
Just popping in


See User information
Quote:
MUIM_GoInactive does not exist in my public MUI headers. Since this solution is suppose to work on OS3.x (and clones), I guess this means your solution isn't workable


I may be missing in the by now quite old MUI 3.8 includes, but it is available in MUI 3.8 already and public since MUI 3.9. Furthermore there is the undocumented MUI features archive on Aminet since more than 14 years by now. This archives contains a header file with lots of useful definitions.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project