SetData pointer facility for Dialog list structures (List, Combo, Selection)

From: Wijck, Bart van <"Wijck,>
Date: Tue, 31 Aug 2004 11:59:10 +0200

----boundary-LibPST-iamunique-1046047210_-_-
Content-type: text/plain

Hi BlackBox users,

When using tree dialog there's the Dialog Setdata procedure which allows one
to associate some data with a particular tree node:

 PROCEDURE (tn: TreeNode) SetData (data: ANYPTR), NEW;

I found this very useful when for example I display a tree with values which
are composite keys. If I select a node I can only retrieve a string:

        VAR
                sn : Dialog.TreeNode;
        :
        BEGIN
                sn := DlgTree.Selected();
                sn.GetName(SelectedString); (* only give me the composite
string, not the record with the key fields *)
but
                r := sn.Data();

directly gives the pointer to the record with the key fields previously
linked with SetData. So I can then easily check the database with the
composite key values, e.g. to see if the selected key still exists.

So far so good. One would have expected the same SetData pointer facility
for List structures (List, Combo, Selection). But there you can only get the
index value of the selected item (via GetItem). So if you typically build up
such a dialog list structure from a linked list with a composite key record
items, then after selection you again only have a selected string. To find
the real composite key you need run down the whole linked list until the
it's ordinal value matches the index values. Simple enough, but a bit
clumsy.

Easily resolved ofcourse if you use an array to fill the dialog list
structure (i.e. the selected index is the index value in the array).

However there must be many instances where the length of the list is
dynamic. So using a SetData pointer facility would be the trick. A
suggestion for improvement?

Regards, Bart



-- 
The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xyTo get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xyCurrent posting policy:
a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
----boundary-LibPST-iamunique-1046047210_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhpIEJsYWNrQm94IHVzZXJzLFxwYXINClxwYXIN
CldoZW4gdXNpbmcgdHJlZSBkaWFsb2cgdGhlcmUncyB0aGUgRGlhbG9nIFNldGRhdGEgcHJvY2Vk
dXJlIHdoaWNoIGFsbG93cyBvbmVccGFyDQp0byBhc3NvY2lhdGUgc29tZSBkYXRhIHdpdGggYSBw
YXJ0aWN1bGFyIHRyZWUgbm9kZTpccGFyDQpccGFyDQogUFJPQ0VEVVJFICh0bjogVHJlZU5vZGUp
IFNldERhdGEgKGRhdGE6IEFOWVBUUiksIE5FVztccGFyDQpccGFyDQpJIGZvdW5kIHRoaXMgdmVy
eSB1c2VmdWwgd2hlbiBmb3IgZXhhbXBsZSBJIGRpc3BsYXkgYSB0cmVlIHdpdGggdmFsdWVzIHdo
aWNoXHBhcg0KYXJlIGNvbXBvc2l0ZSBrZXlzLiBJZiBJIHNlbGVjdCBhIG5vZGUgSSBjYW4gb25s
eSByZXRyaWV2ZSBhIHN0cmluZzpccGFyDQpccGFyDQpcdGFiIFZBUlxwYXINClx0YWIgXHRhYiBz
biA6IERpYWxvZy5UcmVlTm9kZTtccGFyDQpcdGFiIDpccGFyDQpcdGFiIEJF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dC4gVGhhdCB3YXksIHRoZSBsaXN0IHNlcnZlciB3aWxsIHJl
Y29nbml6ZSB5b3UgYXMgc3Vic2NyaWJlciBhbmQgZm9yd2FyZCB5b3VyIHBvc3RpbmcgaW1tZWRp
YXRlbHksIHdpdGhvdXQgY3JlYXRpbmcgYW55IG92ZXJoZWFkLlxwYXINClxwYXINCmIpIElmLCBm
b3Igc29tZSByZWFzb24sIHlvdSBjYW5ub3QgcG9zdCBmcm9tIHRoZSBhZGRyZXNzLCBieSB3aGlj
aCB5b3UgYXJlIHN1YnNjcmliZWQsIHlvdXIgbWVzc2FnZSB3aWxsIGJlIG1vZGVyYXRlZCB0byBh
dm9pZCBzcGFtLiBQbGVhc2UgdW5kZXJzdGFuZCB0aGF0IG1vZGVyYXRpb24gd2lsbCBvZnRlbiBj
YXVzZSBzb21lIGRlbGF5LCBpbiBwYXJ0aWN1bGFyIG92ZXIgd2Vla2VuZHMgb3IgaG9seWRheXMu
XHBhcg0KfQ==
----boundary-LibPST-iamunique-1046047210_-_---
Received on Tue Aug 31 2004 - 11:59:10 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:28:38 UTC