1. Valdas Vaitiekaitis
  2. PowerBuilder
  3. Tuesday, 8 June 2021 05:54 AM UTC

In my project users need to be able to copy data from SingleLineEdit, MultiLineEdit and similar controls event when they are not supposed to edit that data. To achieve this functionality instead of disabling controls I set them to DisplayOnly and change background color to indicate that it is read only. However, if theme is applied, custom background coloring is gone.

Any ideas on how to work around this?

Maybe there is something like display-only-state? Or maybe it is possible to make disabled controls data selectable?

Accepted Answer
mike S Accepted Answer Pending Moderation
  1. Tuesday, 8 June 2021 16:02 PM UTC
  2. PowerBuilder
  3. # Permalink

themes don't support any concept of that.  You have to do it via powerscript today.

 

if you want themes to do that, then you need to enter it as an enhancement

here are similar requests for being able to do this sort of thing in datawindow columns.  Same idea, same theme limitations:

https://www.appeon.com/standardsupport/search/view?id=3719
https://www.appeon.com/standardsupport/search/view?id=6632

 

Comment
  1. Chris Pollach @Appeon
  2. Tuesday, 8 June 2021 16:19 PM UTC
Hi Mike ... you are correct. This would require an enhancement to the current Theme feature.
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Tuesday, 8 June 2021 16:57 PM UTC
I didn't explain clearly, and I have revised my answer to be clearer. Valdas issue is UI themes is overwriting the color changes he is doing via PowerScript. So I was suggesting he turn off UI themes for those specific controls so that he can still use UI themes but not affect those specific controls that need to have different background color.
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 9 June 2021 08:00 AM UTC
  2. PowerBuilder
  3. # 1

Just a suggestion:

What we do for disabled controls, is have an option in the contextual menu when clicking right mouse button which says "Copy contents". We don't use the readonly attribute.

 

Comment
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 8 June 2021 14:55 PM UTC
  2. PowerBuilder
  3. # 2

Hi Valdas, Set a custom theme for those objects that you want to appear different color than the rest of your app AND set the themes to disabled using "{“drawing”:false}" command.  Read the "Custom theme definition files for selected objects or controls" and "How to turn off UI Theme at runtime" sections of this tech article: https://community.appeon.com/index.php/articles-blogs/tutorials-articles/2-powerbuilder/301-applying-a-new-ui-theme-to-your-application-2

{
 "meta-info":
 {
  "version":"190"
 },
  "w_main.uo_1.cb_1":
 {
   ...
   // Copy the settings from the "commandbutton" node of
   //the "theme.json" file and then modify
 }
  "w_main$commandbutton":
 {
   ...
   //Copy the settings from the "commandbutton" node of
   //the "theme.json" file and then modify
 }
  "w_main":
 {
   ...
   //Copy the settings from the "window" node of
   //the "theme.json" file and then modify
 }
}
Comment
  1. Valdas Vaitiekaitis
  2. Wednesday, 9 June 2021 05:52 AM UTC
I want those objects appear different only when they are set to DisplayOnly. And only those objects, not the whole app. I want them to look according to theme when they are in normal state.
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 8 June 2021 12:56 PM UTC
  2. PowerBuilder
  3. # 3

I think you have done what you asked for in order to make a disabled field selectable:
1.  Set taborder of the field > 0.
2.  Set Edit property DisplayOnly.

If you want a specified set of options for the user, use the RMBUTTONDOWN event to invoke options you can add to the popup DW menu.

Comment
  1. Valdas Vaitiekaitis
  2. Tuesday, 8 June 2021 13:51 PM UTC
I need to change color of a readonly control to indicate to user that it is readonly. I can not do that with themes because themes overwrite custom colors.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.