1. Simone Olianti
  2. PowerBuilder
  3. Thursday, 21 June 2018 12:13 PM UTC

Hi there, i'm experiencing a strange behaviour accessing a treeview control in pb2017.

I populate a treeview with some data coming from a json object and then launch a function that scans its data sequentially according to its levels and branches.
Everything working fine until i try to reset the same treeview and repopulate it for example with the same data.
If i try to read the the tv again starting from the beginning it looks completely unsorted....The strange part is that i see the branches in the control correctly but when i try to read it, the labels and data are completely mixed. I get a different result everytime i reset it.
To reset the treeview control i use the tv_1.deleteitem(0)
Is this right or maybe should i use a different approach? am i missing something?

Consider that if i close the window with the tv control and reopen if the first time everything working fine again...

any help would be appreciated,

tia

 

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 21 June 2018 14:00 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Simone;

   We might need to see your code before offering any more advice on this issue.

In the mean-time, I would suggest the following alternatives ...

  1. Use a TreeView DataWindow instead of a TV Control. Then you would only need to do DC.Reset ( ) command to clear everything.
  2. Use a Visual User Object that incorporates a TV Control. Do not place the UO in the Window. Instead, dynamically open the UO via the OpenUserObject() command. Then at reset time, use the CloseUserObject() followed by the OpenUserObject() commands to completely refresh the TV without any complex PowerScripting.

Food for thought.

HTH

Regards ... Chris

Comment
  1. Simone Olianti
  2. Thursday, 21 June 2018 14:45 PM UTC
amazing.



thank you Chris...looks like the visual uo approach is working !

  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 21 June 2018 15:26 PM UTC
That is excellent news Simone ... Thanks for the feedback!  

  1. Helpful
  1. Jeff Wayt
  2. Friday, 9 November 2018 22:11 PM UTC
The solution to use the OpenUserObject() command and reset using the CloseUserObject() did wonders! I was getting a 14 second penalty using deleteitem().
  1. Helpful
There are no comments made yet.
Eduardo G. Accepted Answer Pending Moderation
  1. Thursday, 21 June 2018 13:38 PM UTC
  2. PowerBuilder
  3. # 1

E.g.

ll_rootitem = THIS.FindItem(RootTreeItem!, 0)

DO UNTIL rootitem = -1
     THIS.DeleteItem(ll_rootitem)
     // Find next root item
     ll_rootitem = THIS.FindItem(RootTreeItem!, 0)
LOOP


I hope this helps.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.