Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 06 OCT 2004 03:36:50PM Stephen Sutherland wrote:

I'd appreciate advice on a problem I am stuck on. I've tried is several different ways, and I'm still no closer to an answer. And it seems like such a simple thing…

I have a form bound to a table. Just after a row is read, the system checks if the CE_USERNAME control is filled (to note who initially entered the record). If it is not filled, the system fills it with a default value (from @USERNAME). Focus is then set to a different control.

This appears to work since the control shows the username. However when the row is saved, the username column is still null.

If I manually move the cursor to the username control, then save the row, the username column is then filled in. But I do not want to move the cursor to that control.

Any suggestions?


At 06 OCT 2004 04:01PM Richard Bright wrote:

What property are you setting a value - DEFPROP or TEXT or ? I have a recollection that you need to first set focus to the control, set the text / defprop value and then lostfocus to the next control else the entered value doesnt pass thru the event logic to an internal value.

Richard Bright

BrightIdeas New Zealand


At 06 OCT 2004 04:03PM Ray Chan wrote:

Stephen,

Briefly, when you set the control to the default value (i.e., @username), do a set_property. For example, assuming that you are using an EditLine, try this: Set_Property(@window:".EditLineName","DEFPROP",@USERNAME).

Hope this help,

Ray Chan


At 07 OCT 2004 10:58AM Stephen Sutherland wrote:

Thank you Richard. It is now working as desired using:

EditLineCtrlEntId=@Window :'.CE_USERNAME'

Username=@Username

OldVals=Set_Property( EditLineCtrlEntId, 'FOCUS', True$ )

OldVals=Set_Property( EditLineCtrlEntId, 'TEXT', UserName )

Stat=Send_Event( EditLineCtrlEntId, 'LOSTFOCUS' )

Previously I had only done the 'TEXT' property. I guess that by setting the focus, the generating a LOSTFOCUS event, it does the necessary system event processing to update the data column in the row with the value in the control.


At 07 OCT 2004 03:08PM Richard Bright wrote:

Stephen,

Just as a reflection, I would be inclined to drop your Send_Event and replace it with a Set_Property to set the focus on the next control. Also, to be pedantic I note that you are setting the TEXT property of the Editline which is the default, triggering the SAVEWARN in the window, otherwise set the DEFPROP property as this works out the correct default for the control. The NextFocusID can be possibly retrieved as a passed parameter if this all happens in the context of the lostFocus event.

ie change

OldVals=Set_Property( EditLineCtrlEntId, 'TEXT', UserName )

Stat=Send_Event( EditLineCtrlEntId, 'LOSTFOCUS' )

to

OldVals=Set_Property( EditLineCtrlEntId, 'TEXT', UserName )

OldVals=Set_Property( 'SYSTEM','FOCUS', NextFocusID )

This has the effect of triggering the Send_Event in a 'natural' way. Its all a matter of opinion, but I tend to let the system generate the events (unless I have a specific reason) so as to ensure I dont trample on system logic.

Richard Bright

BrightIdeas New Zealand

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/20b7b335a45613cf85256f25006bbe0e.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1