Brad
GetLayoutObjectAttribute ( <objectName> ; "IsFrontTabPanel" ) should
enable you to do what you want, but rather than being able to capture
the front tab's name directly, you have to check each name in turn.
cheers
Tom
On 14 Aug 2009, at 16:50, Brad Lowry wrote:
Hi All,
I think I must be missing something simple (I hope).
(FM10.0v3 Advanced)
So I can create a Tab Set with tabs "Tab One" and "Tab Two".
In layout mode I select each tab and give them Object Names of tab1
and tab2 respectively.
I can create a test button, Go To Object (tab2), that behaves as
expected.
Then, when I right-click on the tab and choose Set Script Triggers ->
Then select "OnObjectModify" and assign a Script (enabled in Browse)->
Back in Browse mode if I click on Tab Two the Script Trigger I set
up will indeed run.
However, the same script runs regardless of which tab I select!
Why does each Tab have the ability to have an ObjectName (and behave
as such for GoTo Object), however, when you click on one of the tabs
the ActiveLayoutObject (either as a script parameter, or in
DataViewer) is empty? Indeed, the Tab Control Tool "overall group"
seemingly cannot have its own ObjectName assigned to it, yet that
seems to be the Object that the OnObjectModify call is "listening" to.
I went through all the Get() functions [in Particular
Get(TriggerAction) and Get(TriggerModifierKeys)]and there were none
that seemed to do the trick.
Is there an easy (and still elegant) way to attach a script to a tab
navigation where *which* tab (as ObjectName or other capturable
value) can be isolated and used as a parameter?
I really would have expected that clicking a layout object
(including specific tabs) simply made it the "active" one.
I would have expected two additional things: 1) for Script Triggers
I would have expected an "OnObjectClick" (since Click isn't really
the same as Modify); and 2) in the Get() functions I would have
expected Get(ObjectClicked) [especially if it really is meaningfully
different than "active"]. But these two things would be Gravy if
there is some other State Attribute I can gather as a Parameter for
the OnObjectModify Script Trigger that is specific to the Tab being
selected.
This was my preferred MO with FM6: customary multi-layout "tab
effect" was accomplished with many layouts and tab buttons that were
"GoToLayout" buttons. Almost immediately I went with each button
calling a script that was (before button/script prameters)
"GoToLayout1", "GoToLayout2" and so on. When the only step was
"GoToLayout(Layout1)", the extra effort of writing the script would
be wasted since the effect was equivalent. However, as the
application got more complex (as applications always seem to do), I
was almost always calling some validation script, some access
privilege test, some referential integrity check or whatever along
with the simple GoToLayout.
Don't get me wrong, I love the whiz-bang Tab Control Tool and the
new Script Trigger feature, but I am tempted to do it the "old
fashioned way" for lack of scripting upon tab selection for a
Particular Tab.
With Script Trigger and a Tab being an Nameable LayoutObject I
thought that frustration was going to be a thing of the past. I hope
I wasn't wrong!
Thanks in advance for any assistance.
--
Sincerely,
Brad