Question How to specify validation expression for a dynamically created widget?

Dragon13

Member
Hello everyone,

I am using Progress 10.2.B07 on Windows 7, 64-bit. For CHUI I try to write a simple program, which creates a Frame and a "FILL-IN" widget in it. Now, I stuck with specification of Validation Expression for the dynamic widget. Here is my code:

Code:
def var hf as handle no-undo.
def var ht as handle no-undo.
def var hfn as handle no-undo.

create frame hf
assign
  box = yes
  row = 1
  col = 1
  width-chars = 50
  height-chars = 20
  name = "hello"
  title = "test validation"
  dcolor = 0.

create text ht
assign
  frame = hf
  row = 2
  col = 1.

create fill-in hfn
assign
  frame = hf
  row = 2
  col = 10
  width-chars = 20
  format = "x(10)"
  side-label-handle = ht
  label = "test"
  screen-value = ""
  validate-expression = "self:screen-value = hello"
  help = "say hello"
  sensitive = true.

on go of hf
  do:
  if not hf:validate("ENABLED-FIELDS") then
  return no-apply.
end.

hf:visible = true.
wait-for go of hf.

When I run it, I get message with the error code 4052. The description to this error code says quite clear that I am not allowed to set validate-Expression attribuite, but what else can I use to specify Validation for dynamically created "FILL-IN" widget???

Thank you in advance!
 
Last edited by a moderator:

TomBascom

Curmudgeon
"Validation" is one of those concepts that "made a good demo" in 1985.

It has no place in a modern application.

My advice is that you not try to use it and be thankful that your attempts have not succeeded.
 

Dragon13

Member
Hello Tom, thank you for the quick answer, but could explain shortly, why "It has no place in a modern application" or tell me where I could read about it? It is just, the way I see it, I have a field, where a user should type in some Information and it seems for me Logical that the entered Information should be validated.
 

TomBascom

Curmudgeon
Validation of this sort tightly couples logic, data and UI.

That makes a nice demo but it is a nightmare to maintain in a real application.
 

Dragon13

Member
Ok, now I see what you mean. You are right, thanks for your advice. I solved it differently - without Validation.
 
Top