cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with row selection on child dddw

Former Member
0 Kudos

Hi,

I am currently working with dynamic dddws that display data based on the selection from a previous dynamic drop down datawindow.  We are setting the row height to 0 for any rows that need to be hidden on the drop downs.

I am using PowerBuilder 12.5 Classic.

I am currently trapping the up and down arrows on these drop downs using the pbm_command event to try and prevent the users from selecting a zero (0) height row in the drop down. 

I am running into a problem where the drop down starts off null/empty.  If the user hits the up arrow, the first row is selected.  My logic checks if the row is a zero height row on the datawindowchild and is setting the column to null or reverting to its previous value.  If the user then hits the up arrow again, they are able to pick a row with a zero height.

I am currently checking for notificationcode 2048 (rowfocuschanged for the child drop down I believe).  Since the row doesn't change when the user pushes the up arrow twice, I am not getting into my logic and the value for the zero height row is being assigned.

Question 1: Is there a way to set the current row for the child drop down datawindow to zero (0) in this case?  I have looked at SetRow but it specifically states that the row value must be one (1) or greater.

Question 2: If not, is there another notificationcode I should be checking other than 2048?  I have tried to find a list of what each notificationcode relates to for a powerbuilder event but I have not been able to find anything.


Any help or suggestions on this issue would be greatly appreciated.


Thanks,

Karen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The first thing you need to do is make sure all your 'invalid' drop down rows are sorted to the bottom.  This can be accomplished by adding "RowHeight() D" as the first sort criteria in your drop down DataWindow.  When your code fires to set the detail height make sure a Sort() is executed at the end. After that you should only need code in the ItemChanged event which checks the value.  If it is not good then reject it (RETURN 1) and the original will be set back.

The reason for all of this is so you won't have to worry about if the user was scrolling up or down in the drop down.  All you care about is they got to a value that is not valid and you reject it.  If you hide rows in between other valid rows then your logic would have to know what the user did (ie. Up Arrow, Down Arrow).  You would then need to skip those values until they got to a valid one otherwise they could not scroll to the next item in the visible list.

Hope this helps,

Chris Craft

Former Member
0 Kudos

Thanks Chris, I will look into the sort.  I did not know you could include a function in a sort.

Karen

Former Member
0 Kudos

Thank you Christopher, the sort resolved all of my issues.


Thanks again.

Karen

Former Member
0 Kudos

Good to hear!

Chris Craft

Answers (1)

Answers (1)

Former Member
0 Kudos

Have you tried filtering out the invalid choices from the DDDW instead?

Former Member
0 Kudos

Ronnie,


I would filter, but my data and display columns are not always the same so filtering would cause me to lose the display value for filtered results.

Karen