1. James Medick
  2. PowerBuilder
  3. Tuesday, 29 June 2021 02:59 AM UTC

I cam across this function code useful for checking whether required columns have been filled.

How does one call this function (pass a datawindow object?), when the argument is a datawindow?

Thanks,

Jim

----------------------------------------------------------------------

DataWindow adw_control

integer li_colnbr = 1
long ll_row = 1
string ls_colname, ls_textname

// Make sure the last entry is accepted
IF adw_control.AcceptText() = -1 THEN
adw_control.SetFocus()
RETURN -2
END IF

// Find the first empty row and column, if any
IF adw_control.FindRequired(Primary!, ll_row, li_colnbr, ls_colname, true) < 1 THEN
//If search fails due to error, then return
RETURN -2
END IF

// Was any row found?
IF ll_row <> 0 THEN
// Get the text of that column's label.
ls_textname = ls_colname + "_t.Text"
ls_colname = adw_control.Describe(ls_textname)
// Tell the user which column to fill in
MessageBox("Required Value Missing", &
+ "Please enter a value for '" &
+ ls_colname + "', row " &
+ String(ll_row) + ".", &
StopSign! )
// Make the problem column current.
adw_control.SetColumn(li_colnbr)
adw_control.ScrollToRow(ll_row)
adw_control.SetFocus()
RETURN -1
END IF

// Return success code if all required rows and columns have data
RETURN 1

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 29 June 2021 03:22 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi, James -

From the looks of it, you would define this function with a single argument of type datawindow (i.e., a datawindow control) named adw_control, returning an integer.

No DW object is needed.

Comment
There are no comments made yet.
James Medick Accepted Answer Pending Moderation
  1. Tuesday, 29 June 2021 13:40 PM UTC
  2. PowerBuilder
  3. # 1

Thanks so much

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 29 June 2021 03:24 AM UTC
  2. PowerBuilder
  3. # 2

Hi Jim;

 Yes from what I can see, the "adw_control" reference should be the address of a DW Control passed into this code as an argument.

Regards ... Chris

Comment
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.