1. Robert Sawyer
  2. PowerBuilder
  3. Wednesday, 12 June 2024 23:36 PM UTC

I have a datawindow column comment and a label (text). Instead of seeing the labels like this

I want the label to appear in the column itself - like in the red box. I also want the background to change when a user clicks there so it is apparent where the focus is on the dw.

In the background expression on my column_name I have 

If( (getrow()=currentrow() and gf_get_column_with_focus() = 'comment'),
selected color, not selected color() ). But this only sets the background of the column.

When I click on the area where the label is, I don't know how to change the background of the label and the column in an expression.

And when I click on the column I want the label background to change as well - to give the appearance of one big column.

I thought about putting something in the clicked event of the dw, checking for text_t, then setting the background of test_t and columname - _t for example. But, seems like it would still appear selected after clicking on another column.

This is a pic of mu actual dw

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 13 June 2024 10:11 AM UTC
  2. PowerBuilder
  3. # 1

Use the ItemFocusChanged() event:

 

If you name the labels as the name of your column + "_t", then when the event fires, you can deduce the label that also has to be modified.

So have for example a column named "column_name" and a label named "column_name_t".

(keep the name of the last column in an instance variable, so that at the beginning of the code of your itemfocuschanged you set the background color back to what it has to be when not having focus.)

 

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Thursday, 13 June 2024 06:50 AM UTC
  2. PowerBuilder
  3. # 2

Hi.

You need something like this?

Powerbuilder doesn't offer an easy way (drag a ready control) to do that. But you can for sure simulate that. In the above example, I'm using a text object and two columns. The first columns marks the area (is read only and set to set focus to the second one). The second is the edited one. This is the way I did it. But you can figure other ways of doing this.

Andreas.

Comment
  1. David Peace (Powersoft)
  2. Thursday, 13 June 2024 13:52 PM UTC
I think this is the most likely way to get this working. The clicked event will not work when you move off the column and or if you tab to a column.
  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.