Page 1 of 1

datatable disabled text selection

Posted: Thu Apr 20, 2023 12:58 am
by Dino
Hi guys,

Maybe you have seen this before.

I know you can add things to a web page to disable text selection...
but if you create a simple web page with a datatable like this one:

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME)
Define_Com Class(#PRIM_LIST) Name(#List) ColumnHeaderHeight(48) ColumnLines(False) DisplayPosition(1) Height(360) Left(48) Parent(#COM_OWNER) RowHeight(48) TabPosition(1) Top(53) Width(500) SelectionStyle(All)
Define_Com Class(#PRIM_LIST.String) Name(#ListColumn1) ColumnWidth(117) DisplayPosition(1) Parent(#List) SortOnClick(True) Source(#STD_CODE)
Define_Com Class(#PRIM_LIST.String) Name(#ListColumn2) ColumnWidth(246) DisplayPosition(2) Parent(#List) SortOnClick(True) Source(#STD_DESC)
Evtroutine Handling(#Com_owner.Initialize)
#STD_CODE := "A1"
#STD_DESC := "JOHN"
Add_Entry
#STD_CODE := "A2"
#STD_DESC := "MARY"
Add_Entry
Endroutine
End_Com
and you try to copy the text MARY to your clipboard, it is disabled and you cannot copy it...
how you enable it? without making changes to make those fields input.

kind regards

Re: datatable disabled text selection

Posted: Fri Apr 21, 2023 8:20 pm
by René Houba
Hi Dino,

I did some testing but did not find a solution for this.
Probably raise an enhancement??

You cannot even select the name for example when is is displayed in out put mode.

Re: datatable disabled text selection

Posted: Wed Jul 12, 2023 1:21 pm
by BrendanB
Dino,

I know this is from earlier this year, but a possible solution:

1. set ColumnReadOnly(False) on each column you want to be able to copy...
2. Handle the KeyPress event on each column (just set Handled to True to stop propagation). This will mean that the value can not be changed. (essentially, this turns the 'input' field into a display only field, but allows the contextMenu to work....)

i have tested at EPC150050 and it works.

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB)
Define_Com Class(#PRIM_LIST) Name(#List) ColumnHeaderHeight(48) ColumnLines(False) DisplayPosition(1) Height(412) Left(48) Parent(#COM_OWNER) RowHeight(48) TabPosition(1) Top(53) Width(1041) SelectionStyle(All)
Define_Com Class(#PRIM_LIST.String) Name(#ListColumn1) ColumnWidth(117) DisplayPosition(1) Parent(#List) SortOnClick(True) Source(#STD_CODE) ColumnReadOnly(False)
Define_Com Class(#PRIM_LIST.String) Name(#ListColumn2) ColumnWidth(653) DisplayPosition(2) Parent(#List) SortOnClick(True) Source(#STD_DESC) ColumnReadOnly(False)
Evtroutine Handling(#Com_owner.Initialize)
#STD_CODE := "A1"
#STD_DESC := "JOHN"
Add_Entry
#STD_CODE := "A2"
#STD_DESC := "MARY"
Add_Entry
Endroutine
Evtroutine Handling(#ListColumn2.KeyPress) Handled(#Handled)
#Handled := True
Endroutine
Evtroutine Handling(#ListColumn1.KeyPress) Handled(#Handled)
#Handled := True
Endroutine
End_Com

Re: datatable disabled text selection

Posted: Wed Jul 12, 2023 11:55 pm
by Dino
Awesome! that works!

Thank you Brendan