The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Populating controls after LOAD with default values
Posted: 30 Aug 06 6:04 PM
|
fiogf49gjkf0d Is there a way to programatically populate some controls on a form? I'd like to populate some controls with default values when the record is new.
SLX doesn't seem to be giving us the equivalent of VB's form LOAD and ACTIVATE events so when I try to put something into a bound control, I come up with.. well... whatever is in the record, which in the case of a new record is nothing.
I've also tried to use a SQL "SELECT ... INTO" command to try to copy a (default) record into a temp table then insert back into the one I'm using but I just get a "unable to parse" error. |
|
|
| |
| |
|
Re: Populating controls after LOAD with default values
Posted: 30 Aug 06 7:24 PM
|
fiogf49gjkf0d How is the form that contains the controls launched?
I have created forms that auto fill some fields if a new record is being added. If the form is called from a grid I use the OnAdding event to set a global variable that I look at in the when open event of the form.
Another approach is to put a object containing the primaryid of the table the form goes after on the form. It the primaryid field is empty I know I am in add mode. If the primaryid is not empty I know I am in edit mode. |
|
|
|
Re: Populating controls after LOAD with default values
Posted: 30 Aug 06 8:51 PM
|
fiogf49gjkf0d This is a data form called as Add/Edit from a grid. All is well if it's edit because SLX very nicely fills in the bound controls.
I have no problem getting the data over to the form (I pass a recordset through a global), but can't fill in the controls, even though I try to do it in the OnLoad event. If this were VB I'd be looking for the Activate event which would happend after the bound controls have been populated with table data. Here, there is no such event. I can unbind all of the controls and populate them manually, but I'm trying to do as little work as possible (I'm sure you know how it is).
It sounds like you're doing what I want to do, Frank. And you're using the method that I've tried. Maybe I'm missing something. |
|
|
| |
| |
|