PDA

View Full Version : Extension template question



Bidmaron
January 18th, 2011, 05:00
With the extension override rules, can I create a control template with the same name as a ruleset template that then overrides what the ruleset was doing? That is, when the ruleset references the template, my extension's definition will override the ruleset's definition, right?

On a related note, there is no limit to how high I go on this, is there? That is, can I override genericcontrol and add a click handler that would handle an alt-click event but pass other events on to other handlers?

Bidmaron
January 18th, 2011, 21:09
I don't think I can override genericcontrol. At least I haven't figured out a way to do it. But I do have another idea....
For anyone thinking I'm talking to myself, I guess that's true, but I didn't want any of the super-coders out there wasting any time on something I figured out myself.

Zeus
January 18th, 2011, 21:50
With the extension override rules, can I create a control template with the same name as a ruleset template that then overrides what the ruleset was doing? That is, when the ruleset references the template, my extension's definition will override the ruleset's definition, right?


Generally yes, although some components like the chatwindow require the entire object and all script components to be overwritten.



On a related note, there is no limit to how high I go on this, is there? That is, can I override genericcontrol and add a click handler that would handle an alt-click event but pass other events on to other handlers?

You should be able to override any templates and base methods.

e.g.

If a ruleset implements a template called mystringcontrol which implements a standard stringcontrol with a custom font in Red, you can override mystringcontrol and define the font color as Green. Anytime the ruleset makes use of mystringcontrol it should use of the extension's overidden version.

Bidmaron
January 18th, 2011, 23:05
But I can't make a template with the name of a standard fg2 component can I? I can't make a template like:


<template name="genericcontrol">
<genericcontrol>
...
</numberfield>
</template>

I wanted to do that so I could provide an event handler active for every control that I could intercept and pass to my Fantasy backGrounds program to provide context-sensitive help. (btw, I'm not a windows expert, any reason why I couldn't use alt-<enter> to bring up context-sensitive help? No one else is using that for anything are they?) But I don't think such a self-referencing template will work, so I have to resort to a more burdensome method (my concept is to in my extension's initialization code register an OnWindowOpened handler and log every window opened, balanced by an OnWindowClosed handler and also tapping into the onAlt event. When user alt-clicks, I can then find the relevant window he clicked in by getting the mouse coordinates and walking the window list to find which window he was in. Then I'd walk the window's control list recursively to find the most deeply nested control the user clicked in. I'd then pass all this info back to Fantasy backGrounds, which would use that to bring up the context-sensitive help. I can't see why that won't work).

The thing I'll have to think a little bit about is how to handle the window list on the client, since the client can't create nodes. I'll probably have to message the list back to the host and register the client as the owner. Can a client owner of a data node destroy the node (as in when the client closes the window and I no longer need the window information) or will I have to message back to the host and get the host to destroy it?

Alternatively, on the client, I could store the window list in the client's registry, but that seems like a misuse of resources. Any of the uber-coders out there have a though on which way would be the best?

Bidmaron
January 18th, 2011, 23:30
One problem I know of with my plan:

Is there any way to know the z-order of windows? I can find out (I think) which window(s) the user's click is over, but if the windows are stacked/overlapped, how can I tell which one is on top? I can't see how to track that. There is no global onClick and there is no windowinstance event I can trap to detect a window coming to the front. Anyone have any ideas here?

Moon_wizard, unless you have any other idea here, what I need either a handler that can be registered for a window activation (i.e. window brought to front) or a getWindowZOrder. Otherwise, every window in every ruleset and extension would have to get code modified to support context-sensitive help.