Frame Focus

Hi folks,

I have the following scenario :-

A smart window containing a number of smart frames to give a simple multiple document interface, i.e. each frame functions independently and we can, say, have a customer maintenance screen open and an order enquiry open.

I'm writing a generic utility which exports out to a spreadsheet (or PDF, etc.) the data in any browsers which are held in the frame in focus.

Dead easy !! Or so I thought. I can recursively walk the widget tree to find all frames, however, I'm dammed if I can find which frame has focus - obviously each smart frame may have multiple static frames in it.

I've tried using the selected attribute, but, it doesn't seem to trigger by simply clicking the title bar of the frame - HELP !!

This is a fairly urgent one and I'm pulling my hair out.

Thanks in advance.
 

gcampbell

Member
I haven't used SmartObjects since V8 (and that was a very bad experience) so I don't know how they've changed. And without knowing exactly what you are doing (or how you're doing it) its a little hard to guess.

But, taking a stab in the dark. Is it possible to do an ON ENTRY OF FRAME ANYWHERE and set a session variable (ie: global variable) that could then be used by your generic processor to get the handle of the currently enabled/visible frame?

HTH,
Gordon
 
Stick this in your main Smart Window definitions.

ON 'ENTRY':U ANYWHERE
DO:

APPLY 'ENTRY' TO SELF.

MESSAGE FOCUS:FRAME SKIP SELF:TYPE SKIP SELF:NAME
VIEW-AS ALERT-BOX INFO BUTTONS OK.

END.

You'll likely get a couple of conflicting messages every time you click a widget or frame, but the last message should always be the focussed frame (static, not SmartFrame).

So following Gordon's suggestion, you can use the above to store a LastFocussedFrame value, ie. in place of the MESSAGE statement, something like:

IF SELF:HANDLE <> <export-button-handle> THEN LastFocussedFrame = FOCUS:FRAME.

HTH

Please test this thoroughly, as I had a hell of a time working it out - Progress ENTRY handling is quite confusing. It doesn't look right, either :(
 
Lee Curzon said:
Stick this in your main Smart Window definitions.

ON 'ENTRY':U ANYWHERE
DO:

APPLY 'ENTRY' TO SELF.

MESSAGE FOCUS:FRAME SKIP SELF:TYPE SKIP SELF:NAME
VIEW-AS ALERT-BOX INFO BUTTONS OK.

END.



IF SELF:HANDLE <> <export-button-handle> THEN LastFocussedFrame = FOCUS:FRAME.

Ahem.

ON 'ENTRY':U ANYWHERE
DO:


MESSAGE SELF:FRAME SKIP SELF:TYPE SKIP SELF:NAME
VIEW-AS ALERT-BOX INFO BUTTONS OK.

END.

and

IF SELF:HANDLE <> <export-button-handle> THEN LastFocussedFrame = SELF:FRAME.


You may need to do a valid handle check on SELF:FRAME, and obviously any ENTRY events on widgets will need to be edited.

(I got completely distracted by the FOCUS handle, which I've not used before. My apologies to Gordon, because I've essentially duplicated his post.).
 
Hi folks,

Thanks for these replies. I'll give them a whirl.

Know what you mean about Smart Objects. We simply use them to allow creating a MDI (Multiple Document Interface) with Frames instancciated at run-time. Allows us to create the frames as seperate little modules and assign them (as modules) to a dynamic menu system and have multiple ones popped up and closed down in the window. Apart from that, we don't gor for any other Smart Object functions - I too used them in V8 and think that generally they are pretty poor.


Down with Dynamics !!

In meetings most of day, but, will give a try and let you know what happens.
 
Top