Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multi row selection

Status
Not open for further replies.

bina8

MIS
Mar 29, 2004
8
US
My customer wants to be able to use the shift and ctl keys with the arrow keys to select multi rows to move from one data window to another. I am currently working on Powerbuilder 6.5 and I don't see anything that will let me do this. Is this even possible? Thanks in advance for any advise.
 
Not sure in PB 6.5, you might be able to use the key down event to look for the key and then put the data into an array, hilight the rows and simulate what function that you are looking for.


Keith
 
This is standard MS Windows functionality. If you use the PFC look at the row selection service. If not you need to check if the control or shift key are pressed (and if so which one), are any other rows already selected, is the current row already selected, and of course that the user clicked on a row. You should encapsulate the code in a NVO and pass the dw to it so you can use the functionality on whatever datawindow you want.
 
just 'borrowed' this code from a fellow company programmer ( I think works in PB6.5)
1. Get into your datasource.
2. Convert it to Syntax.
3. Add onto the end of the field retrievals 'c_checked' = ' '
4. go back to the datawindow---you should find a new field called c_checked on it.
5. Change the field to a checkbox ( x is selected )
6. if a record is selected move it into an array or an datastore.
7. Use the array or datastore to populate a new datawindow ( don't know about this part-I'd have to try it myself ). In any case you should be able to update only the selected records.
8. They use a separate datawindow to do the exclusion-I'll
try to do it on the main datawindow. They also use an 'include' buttonclicked code to handle the selections.
Sorry if this is incomplete; as I am still enabling in my application--
9. You should, of course, back up your window and datawindow to another saved name before making any changes.-
so that you always have a copy of your original to go back to!!
 
in datawindow's clicked event,try this script

IF keydown(KeyControl!) THEN
IF IsSelected(row) THEN
SelectRow(row,FALSE)
ELSE
SelectRow(row,TRUE)
END IF
ELSE
selectrow(0,FALSE)
selectrow(row,TRUE)
END IF


in the button ,you can cycle the datawindow's rowcount and try isselected() function to inspect if the row is selected
and continue your action

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top