datatable disabled text selection

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

datatable disabled text selection

Post 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
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: datatable disabled text selection

Post 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.
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: datatable disabled text selection

Post 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
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: datatable disabled text selection

Post by Dino »

Awesome! that works!

Thank you Brendan
Post Reply