Dealing with quicktabs in the CDK

forum.cdk (2000-2005) & forum.td.cdk (2005-2010)
NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 21 Mar 2008, 06:28

 Posted by:  James McCall 

Does anyone have any sample code on dealing with quicktabs in CDK code?

I would like to write an app which just lists all fields that are on a tab
form and which tabs they are associated with. I can do the first part of
that no problem (list all the fields!) but can't find any CDK functions
concerning tabs. Strangely enough some of the quicktabs functions even
work, eg. SWTabsIsTabControl( ) but others crash the CDK applet, eg.
SWTabsGetCount( ).

In an ideal world I'd like to then allow the programmer (me!) to change
which fields are on which tabs. Doing them one field at a time within the
TD environment is seriously tedious.

I remember there being an app like this, written by one of the Ice Tea group
crew, a long time ago but I can't find it and as far as I know the source
was never made available.

Thanks,
James McCall

p.s. I have attached the code I was playing with, CTD2000 saved as indented
text.

Attachment: EnumTabAssocs.app

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 21 Mar 2008, 18:54

 Posted by:  Jeff Luther 

Well, I see getting access to child ownership for a tab is a bit
complex. I've enclosed a jpg showing the issue. It shows what's diff.
between a sample with a Tab & bkgrnd. text if associated with tab 1 vs.
assoc. with tab 2.

TD has a section in the text outline called ".data CLASSPROPS" that you
will notice has a value that changed from a "1" --> a "2" for the 2
samples. I've got a shot in BeyoneCompare that diffs. the files showing
this.

Now, what I don't see is access to CLASSPROPS exposed for access via the
CDK. Nor do I have a 'map' of what those hex values rep., except for the
change in the jpg; looks like "31" --> "32" if I count each char. pair
from the left, which looks to be 8 2-char. hex values.

I would bet that making diff. slight changes, saving and diff'ing could
yield other info. about what the CLASSPROPS values decipher to.

How about putting a sample together that's stand-alone. It would be
easier to test without having to gen. an EXE and test that way.

Best Regards,
Jeff @ PC Design
info. & samples: www.JeffLuther.net/unify/

Attachment: tabtest.jpg

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 21 Mar 2008, 23:34

 Posted by:  James McCall 

Jeff,

At about midnight last night I considered going down the route of reverse
engineering the CLASSPROPS section as you have started to do. That's when I
thought I'd ask the newsgroup instead.

I know this has been done before, maybe by Gianluca Pivato because I
remember using it in whatever version I used before CTD2000. Maybe the
knowledge has been lost.

As for creating a stand-alone sample, I don't think it's possible - the CDK
code needs an outline handle to work with and that's only available from
with in the TD development environment, not from inside an TD compiled .EXE.
It sure makes debugging CDK apps tricky!

Thanks for taking a look. I think I'll shelve this project for now unless
anyone comes up with other leads (like a fully reverse engineered
CLASSPROPS).

James

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 22 Mar 2008, 03:58

 Posted by:  James McCall 

It seems I lied about two things:
1. Shelving the project (!)
2. That a running app can't get it's own outline handle -
SalOutlineCurrent( ) does the trick.

As it happens it still doesn't help because in a running app the tab frame
is all initialised so all the SWTabxxx( ) functions work fine. So at stand
alone app won't tell me anything about what I can expect the code to do when
running as an extension to the development environment , accessing the tabs
at design time.

So now I think I can shelve it until someone comes up with new ideas.

The code is attached is my sample to show enumeration of child windows,
determining which tabs they are associated with, in a stand-alone app.

James

Attachment: EnumTabAssocs-InApp.app

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 24 Mar 2008, 18:42

 Posted by:  Gianluca Pivato 

Hi James,

You don't need the CDK to read the quicktabs binding info. All you need is
SalWindowGetProperty(). You will find the following properties that may help
(there are others but are not relevant for this case):

on picTabs control
"TabLabels"
"TabNames"
"TabFormPages"

on each bound control
"TabChildNames"

The value is a string containing a list of names separated by a TAB.

The binding is done at the control level. In other words, the picTabs
control doesn't know which controls are bound to it. The controls have that
knowledge. The new tab strip control added in TD 5.1 works at the opposite.

HTH

Gianluca
www.iceteagroup.com

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 24 Mar 2008, 22:22

 Posted by:  James McCall 

Thanks for the hint. I now have an application that can quickly tell me
what fields are associated with which tab, at-a-glance. It's still a CDK
app because I want to be able to run it from the Tools menu.

SalWindowGetProperty( ) doesn't work when running as a development
environment extension but there is a CDK function to do the same thing. The
hint was looking at "TabChildNames" property of the child window.

Now all I have to do is make the app update those properties!

Latest version of my original CDK application is attached.

Thanks,
James

Attachment: jims_EnumTabAssocs1.app

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 24 Mar 2008, 23:22

 Posted by:  Jeff Luther 

"Now all I have to do is make the app update those properties!" - I was
looking at this too and might have a clue!

Here's what I found - Given a variation on an -InApp ver. of your
earlier sample:

df1 is associated with the first tab, named "xxxxxxxxxx". Using the CDK
on the item, this call for that item:
Set nProps = oChildWindow.EnumStrProperties( sAryProperties )

return nProps = 1, and sAryProperties [0] = "TabChildNames" (CDK
declares EnumStrProperties() as returning Bool; in fact it returns # of
array elements.)

Now, if you then:
Call oChildWindow.GetStrProperty( "TabChildNames", sTabNames )
this is assigned: sTabNames = "xxxxxxxxxx"

So, if you can GetStrProperty(), why not SetStrProperty()? Something like:
Set sTabNames = "xxxxxxxxxx" || sTAB_CHARACTER || "yyyyyyyyyy"
Call oChildWindow.SetStrProperty( "TabChildNames", sTabNames )

might work. Why? Because I see that another field dfXYX has as its tab
names list:
"xxxxxxxxxx yyyyyyyyyy zzzzzzzzzz" (which is as Gianluca says: each tab
name separated by the tab character. (Don't confuse 'tab'

Your newest sample only includes cdkfwrk.apl, so I'll let you test to
see if setting the field's prop. does indeed--in this case--add it to
tab 2. Let us know.

Best Regards,
Jeff @ PC Design
info. & samples: www.JeffLuther.net/unify/

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 24 Mar 2008, 23:24

 Posted by:  Jeff Luther 

"Now all I have to do is make the app update those properties!" - I was
looking at this too and might have a clue!

Here's what I found - Given a variation on an -InApp ver. of your
earlier sample:

df1 is associated with the first tab, named "xxxxxxxxxx". Using the CDK
on the item, this call for that item:
Set nProps = oChildWindow.EnumStrProperties( sAryProperties )

return nProps = 1, and sAryProperties [0] = "TabChildNames" (CDK
declares EnumStrProperties() as returning Bool; in fact it returns # of
array elements.)

Now, if you then:
Call oChildWindow.GetStrProperty( "TabChildNames", sTabNames )
this is assigned: sTabNames = "xxxxxxxxxx"

So, if you can GetStrProperty(), why not SetStrProperty()? Something like:
Set sTabNames = "xxxxxxxxxx" || sTAB_CHARACTER || "yyyyyyyyyy"
Call oChildWindow.SetStrProperty( "TabChildNames", sTabNames )

might work. Why? Because I see that another field dfXYX has as its tab
names list:
"xxxxxxxxxx yyyyyyyyyy zzzzzzzzzz" (which is as Gianluca says:
each tab name separated by the tab character. (Don't confuse 'tab' --
the object -- with "tab character", ' ' you can def. as a constant.)

Your newest sample only includes cdkfwrk.apl, so I'll let you test to
see if setting the field's prop. does indeed--in this case--add it to
tab 2. Let us know.

Best Regards,
Jeff @ PC Design
info. & samples: www.JeffLuther.net/unify/

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 25 Mar 2008, 05:47

 Posted by:  James McCall 

Yes, aItem.SetStrProperties( ) works. Thanks for keeping the ideas coming.
I attach a rough version. To change the tab association just put an "x" in
the appropriate column(s) and click [Apply].

There are a few issues to iron out:
(a) Calling aItem.SetStrProperties('TabChildNames',STRING_Null) causes the
app to crash so I'm not sure how to remove all tab associations for a field.
I could do with a aItem.RemoveStrProperty( ) function.
(b) The way it's written at the moment any tabs without a field currently
associated will not get enumerated (not too difficult, I can examine the tab
frame's "TabNames" property)
(c) The code needs some checking, especially to ensure that the item
selected in TD when calling the app is a tab frame. Especially before trying
to associate child windows with it! (not difficult, I already discovered
that SWTabsIsTabControl( ) works in my first iteration of this project).
(d) In theory a form/dialog can have more than one tab frame but I won't
bother supporting this because none of the quick tabs code does

James

Attachment: jims_EnumTabAssocs2.app

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 25 Mar 2008, 16:07

 Posted by:  James McCall 

OK, attached is the final version that allows you to set/unset tab
associations.
Thanks to Jeff & Gianluca for the help.
Enjoy! (but don't come running to me if it stuffs something up).

James McCall

Attachment: jims_EnumTabAssocs.app

NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Dealing with quicktabs in the CDK

Post by NewsgroupServer » 25 Mar 2008, 17:37

 Posted by:  Jeff Luther 

Not sure an email directly to you went through, so a couple things:
-- Try an empty string( '' ) instead of STRING_Null to remove all tab
assocs. Why? I don't know... ;-) but TD internally may treat it differently.

-- When does the app crash? Can you get it saved after the change
first? If so, see what your non-associated apt (not indented) looks
like. I've enclosed a jpg of what the field df1 has for CLASSPROPS with
and without tab1 ('xxxxxxxxx') associated. Your with/without should look
similiar; if not, that may be a clue as to what/why it is crashing.

-- I can't get your tool to display correctly and the 2 PBs lower right
are hidden by the TW which is always being sized to the height of the
dlg box. Odd!

- Jeff


[old deleted]
Attachment: jm-noAssociate.jpg

Return to “td.cdk”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests