You are here: Retrieve the value the user keys into the control
LMD DialogPack
ContentsIndexHome
PreviousUpNext
Retrieve the value the user keys into the control

This topic describes how to retrieve the value that the user has entered or selected.

Use the EditValue property on the TJSEditDialog component to determine what value the user has entered or selected in a particular TJSEditDialog component. 

 

Some EditType values do not automatically support returning the value entered or selected. When this occurs, use the OnGetEditValue event to set the correct string representation of the dialog. After using the OnGetEditValue event to set a string representation of the value entered or selected in the dialog, access this value by using the EditValue property. 

 

NOTE: Once handling the OnGetEditValue event, you do not have to reference the EditValue property, since you could just use the OnGetEditValue method to reference the value you would like. 

Most EditType values have associated Wrapper Functions. Wrapper Functions allow you to call a single method to display and return user input from a TJSEditDialog. Refer to the See Also topic for a link to the included wrapper functions. 

 

For this example, drop a TLabel, TButton and TJSEditDialog component on the form. 

In the TButton.OnClick event add the following code. 

 

  Label1.Caption := '';
  if JSEditDialog1.Execute = mrOK then
    Label1.Caption := JSEditDialog1.EditValue;

 

When you run this code a TJSEditDialog will display with only the Edit control visible. Type a value into the Edit control and select the OK button. Whatever value is typed into the Edit control on the dialog, will be reflected in the label control once the dialog has closed. 

 

To expand on the first example, change the EditProperties.EditType property of the TJSEditDialog component on the form to be etCalendar. 

Run the application and click on the button again. Notice how the Label does not get updated. This is because we need to handle the OnGetEditValue event. 

 

Close the application and In the form designer generate an OnGetEditValue event for the TJSEditDialog component. 

Add the following code into the generated event. 

 

  Value := DateToStr(TMonthCalendar(AControl).Date);

 

Run the application again. This time when clicking on the button, the label is updated with whatever date is selected on the calendar from the dialog.

Copyright © 2013 by LMD Innovative. All rights reserved.
Copyright © 2013 by LMD Innovative. All rights reserved.
What do you think about this topic? Send feedback!