usage of DataViewItemArray

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

usage of DataViewItemArray

zliwang
Hi

Can someone let me know how to construct a DataViewItemArray and use it in ItemsAdded(parent, items)? 

On Linux, calling Cleared() does not cause the control to automatically reread the data so I have to call

ItemAdded or ItemsAdded explicitly (Sigh). But if I call ItemAdded repeatedly to add several items under

dv.NullDataViewItem things won't work. Only the first one Added shows up properly. So I think I should use

ItemsAdded(dv.NullDataViewItem, items). But I could not figure out how to build the parameter 'items', which is a DataViewItemArray.

  • DataViewModel
ItemsAdded(self, parent, items)

Call this to inform the model that several items have been added to the data.

Parameters:
Return type:

bool


Thanks

-Xiang Li

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: usage of DataViewItemArray

Matthew Daubney


On Thursday, 22 January 2015 02:10:31 UTC, zliwang wrote:
Hi

Can someone let me know how to construct a DataViewItemArray and use it in ItemsAdded(parent, items)? 

On Linux, calling Cleared() does not cause the control to automatically reread the data so I have to call

ItemAdded or ItemsAdded explicitly (Sigh). But if I call ItemAdded repeatedly to add several items under

dv.NullDataViewItem things won't work. Only the first one Added shows up properly. So I think I should use

ItemsAdded(dv.NullDataViewItem, items). But I could not figure out how to build the parameter 'items', which is a DataViewItemArray.

  • DataViewModel
ItemsAdded(self, parent, items)

Call this to inform the model that several items have been added to the data.

Parameters:
  • parent (<a href="http://wxpython.org/Phoenix/docs/html/dataview.DataViewItem.html#dataview-dataviewitem" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2Fdataview.DataViewItem.html%23dataview-dataviewitem\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHoWUr4Q58cNWRXquNB9lcLkK2_Fw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2Fdataview.DataViewItem.html%23dataview-dataviewitem\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHoWUr4Q58cNWRXquNB9lcLkK2_Fw&#39;;return true;">DataViewItem) –
  • items (DataViewItemArray) –
Return type:

bool


Thanks

-Xiang Li



At the risk or raising the dead... I'm now trying to do this for the same reasons. Is there a method people are using to avoid this problem entirely or could someone point to  a code snippet that shows how to create a DataViewItemArray?

Thanks,

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: usage of DataViewItemArray

Robin Dunn


On Friday, April 21, 2017 at 8:26:01 AM UTC-7, Matthew Daubney wrote:


On Thursday, 22 January 2015 02:10:31 UTC, zliwang wrote:
Hi

Can someone let me know how to construct a DataViewItemArray and use it in ItemsAdded(parent, items)? 

On Linux, calling Cleared() does not cause the control to automatically reread the data so I have to call

ItemAdded or ItemsAdded explicitly (Sigh). But if I call ItemAdded repeatedly to add several items under

dv.NullDataViewItem things won't work. Only the first one Added shows up properly. So I think I should use

ItemsAdded(dv.NullDataViewItem, items). But I could not figure out how to build the parameter 'items', which is a DataViewItemArray.

  • DataViewModel
ItemsAdded(self, parent, items)

Call this to inform the model that several items have been added to the data.

Parameters:
  • parent (<a href="http://wxpython.org/Phoenix/docs/html/dataview.DataViewItem.html#dataview-dataviewitem" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2Fdataview.DataViewItem.html%23dataview-dataviewitem\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHoWUr4Q58cNWRXquNB9lcLkK2_Fw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwxpython.org%2FPhoenix%2Fdocs%2Fhtml%2Fdataview.DataViewItem.html%23dataview-dataviewitem\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHoWUr4Q58cNWRXquNB9lcLkK2_Fw&#39;;return true;">DataViewItem) –
  • items (DataViewItemArray) –
Return type:

bool


Thanks

-Xiang Li



At the risk or raising the dead... I'm now trying to do this for the same reasons. Is there a method people are using to avoid this problem entirely or could someone point to  a code snippet that shows how to create a DataViewItemArray?


There is an example of adding items to a DataViewItemArray in demo/DVC_DataViewModel.py in the GetChildren method. It has an append method that works as expected.  To create a new array you should be able to use its default constructor, like: dva = wx.dataview.DataViewItemArray()

--
Robin Dunn
Software Craftsman
http://wxPython.org

 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...