简体   繁体   中英

How to check if a cell is selected in Powerbuilder datawindow object?

I am trying to implement a copy/paste feature in a datawindow. User will be able to select the cells using mouse. My first step is to identify which row-column pairs are selected.

Thanks.

OK, I found the answer, it's just that we don't have a specific example.

We can use selected property on the datawindow object.

string setting
setting = dw1.Object.DataWindow.Selected

The resulted string will have a syntax of

1stRow/lastRow/Column1{/Column2...}

For example, if you only select 1 cell, it will look like

5/5/name --> this means you selected row 5 on column "name"

If you select horizontally on a row, it will look like

3/3/firstname/lastname/address --> this means you selected cells on row 3 and on columns 'firstname', 'lastname', and 'address'

If you select vertically on a column, it will look like

3/7/age --> this means you selected cells on column 'age', from row 3 to 7

If you select in a rectangle shape, it will look like

3/7/fname/lname --> this means you selected cells on columns 'fname' and 'lname', from row 3 to 7

I hope this post helps other developer looking for this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM