1. Gary Cooper
  2. PowerBuilder
  3. Thursday, 13 August 2020 15:26 PM UTC

I have a 1 row datawindow that contains various lengths of text depending on the query.  The users want to see the last entries upon the open of the datawindow.  I found the following example in your HELP system that I think will solve the problem:

/////

This statement sets the insertion point at the end of the text in the DataWindow edit control:

dw_1.SelectText(dw_1.GetText(), 0)

/////

but it gives an error ' C0052: Bad argument list for function SelectText  '

What is the correct syntax ?
Olan Knight Accepted Answer Pending Moderation
  1. Thursday, 13 August 2020 16:19 PM UTC
  2. PowerBuilder
  3. # 1


Here you go:

// In your case row_num = 1

lls_text = dw_1.GetItemString (row_num, "column_name")

ll_rc = dw_1.ScrollToRow (row_num)
ll_rc = dw_1.SelectText (TRUE)


Later -

Olan


Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 13 August 2020 16:30 PM UTC
  2. PowerBuilder
  3. # 2

Greetings, Gary -

The code snippet you posted affects ONLY the data column that currently has input focus, i.e., where the DW's edit control is currently superimposed over the column object so that it can manage user interaction.

If your data column can contain significantly more information than it can display, you could use a tooltip: In each column where you want this functionality, navigate to the Tooltip tab in the Properties pane of the DW Painter.

First, create an expression for the "Enabled" property. If the column can normally display, say 50 characters on average without truncation, code the expression as (without the surrounding quotes) "If( Len(columnname) > 50, 1, 0)". This enables the display of the tooltip text when the column contains more than 50 characters.

Next, create an expression for the tooltip text: '...'+Right(columnname),100)  This will display the right-most 100 characters contained in the column preceded with an ellipsis (...)

The tooltip will appear when the user moves the cursor over the column.

If you want to continually display the rightmost portion of the data (not just the mouse is over the column), you may need to use a computed field to display the information in addition to the data column.

Regards, John

Comment
There are no comments made yet.
Gary Cooper Accepted Answer Pending Moderation
  1. Thursday, 13 August 2020 17:39 PM UTC
  2. PowerBuilder
  3. # 3

Thanks for your response John and Olan, all that I am trying to do is have the datawindow upon opening, display the last line of data to the user.  Since the datawindow is 1 row of data regardless of how much is in the field, it seems that the SELECTTEXT type functions will do the trick.  However, when I use the SELECTTEXT as in the this snippet:

Here you go:

// In your case row_num = 1

lls_text = dw_1.GetItemString (row_num, "column_name")

ll_rc = dw_1.ScrollToRow (row_num)
ll_rc = dw_1.SelectText (TRUE)

 

 

It generates and error: ' C0052: Bad argument list for function SelectText  '  If this is the syntax for the SELECTTEXT function, why does it generate and error?

 

 

Comment
  1. John Fauss
  2. Thursday, 13 August 2020 19:17 PM UTC
Try this instead: dw_1.SelectText(99999,0). You may also have to issue: dw_1.SetFocus()
  1. Helpful
  1. Gary Cooper
  2. Thursday, 13 August 2020 19:28 PM UTC
John, You the MAN!!! It worked.

Thanks

Gary Cooper

  1. Helpful
  1. John Fauss
  2. Thursday, 13 August 2020 20:27 PM UTC
That's great news, Gary! Thanks for letting us know this worked!
  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.