Diff: wxTreeItemData & wxTreeItemID
by prasanna » Fri, 31 Aug 2007 16:31:43 GMT
Hi,
I'm new to wxWidgets.
Can anyone tell what is the difference between wxTreeData and wxTreeItemID.
I have to develop one treectrl like this.
ROOT
CHILD1
CHILD1.1
CHILD1.2
CHILD2
CHILD3
Can anyone please tell what is the procedure to do that or which methods I
have to use
to accomplish my task.
Regards,
Prasanna.
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments contained in it.
Contact your Administrator for further information.
---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM
Re: Diff: wxTreeItemData & wxTreeItemID
by Ondra Holub » Fri, 31 Aug 2007 20:55:32 GMT
wxTreeItemID is some identification of item in wxTreeCtrl.
wxTreeData is parent class of any user data which may be associated by
user with certain wxTreeCtrl item.
wxTreeCtrl* tree = new wxtreeCtrl(parent, -1);
wxTreeItemId root = tree->AddRoot(_("ROOT"));
wxTreeItemId child1 = tree->AppendItem(root, _("CHILD1"));
wxTreeItemId child11 = tree->AppendItem(child1, _("CHILD1.1"));
wxTreeItemId child12 = tree->AppendItem(child1, _("CHILD1.2"));
wxTreeItemId child2 = tree->AppendItem(root, _("CHILD2"));
wxTreeItemId child3 = tree->AppendItem(root, _("CHILD3"));
Similar Threads:
1.file name with diff country code in diff OS
Dear all
Can anyone tell why I store a file to Windows 2000 server, ((which is in Chinese character)), cannot be read in Macintosh platform
Thank you very much!
2.Diff Perf Diff User?
3.wxTreeItemData::GetId() does not work
A little more experimenting I found that the following sequence:
itemId = m_treeCtrl->AppendItem(parentId, name, itemData->GetNormalIcon());
m_treeCtrl->SetItemData(itemId, itemData);
does not associate the wxTreeItemData object with the wxTreeItemId.
Changing it to:
itemId = m_treeCtrl->AppendItem(parentId, name, itemData->GetNormalIcon(),
-1, itemData);
does the association, but GetId() will ONLY work when called during
a tree event. I still can't call GetId() at some arbitrary time
to get a valid wxTreeItemId.
Any thoughts???
Will
Will Bene wrote:
>
> Given a subclass of wxTreeItemData, I want to select the corresponding
> tree item by calling wxTreeItemData::GetId() and using that id to call
> wxTreeCtrl::SelectItem(). This does not work. The GetId() returns a
> bogus value (a constant value for the wxTreeItemId::m_pItem member
> even for different wxTreeItemData objects.)
>
> Thinking that this call might only be set on tree events, I checked the
> value of the GetId() call during a selection change event. This value
> is always 0. Not what I expected.
>
> Is this a bug or is this feature not intended to be used this way?
>
> (running wxGTK 2.4.2 under Linux).
>
> Thanks,
>
> Will
>
> --
>
> =============================================================================
> William J. Bene XXXX@XXXXX.COM
>
> Mail Stop 125 ANALYTICAL MECHANICS ASSOCIATES
> 15 Langley Boulevard Assigned to Data Analysis & Imaging Branch
> NASA Langley Research Center Building 1268, Room 1057
> Hampton, VA 23681-2199 Phone +1 757 864-2106
>
> =============================================================================
--
=============================================================================
William J. Bene XXXX@XXXXX.COM
Mail Stop 125 ANALYTICAL MECHANICS ASSOCIATES
15 Langley Boulevard Assigned to Data Analysis & Imaging Branch
NASA Langley Research Center Building 1268, Room 1057
Hampton, VA 23681-2199 Phone +1 757 864-2106
=============================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM
4.wxTreeItemData sample
5.wxTreeItemData
Hi
I have this code:
device_treectrl->AppendItem(tree_root_id,device_vector[i].Name,-1,-1,new
wxTreeItemData(device_vector[i]));
where device_vector is a stl vector
Later when I try and get the item back
ESPDeviceInfoStruct *device_info = (ESPDeviceInfoStruct *)
device_treectrl->GetItemData(tree_item_id);
I get another pointer !
Can someone tell me what I have wrong ?
Thanks
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM
6. Re[2]: wxTreeItemData::GetId() does not work
7. 'wxTreeItemData' : base class undefined
8. Needed: int wxTreeItemId::GetHash()