IWAdvMessageDialog focus

I am using a TIWAdvMessageDialog to obtain a string from the user. I have set InputType to string.

  iwDlgForgotPassword.Notes := 'Please enter the email address you registered with:';
  iwDlgForgotPassword.Caption := 'Forgotten password';
  iwDlgForgotPassword.EmptyText := 'Your email address';
  iwDlgForgotPassword.ShowAsync;

The dialog itself works fine but the problem is that when it is shown it does not have focus. The user needs to click in the text box before they can type. How can I set the focus to the text box automatically?

The text box does not receive focus when an EmptyText value is assigned, otherwise this value would not be visible when the dialog is displayed because it is hidden as soon as the text box receives focus.

The text box will automatically receive focus if the EmptyText value is set to an empty string.

Thanks for that Bart.

If I take the edit box off the dialog and just show a simple dialog with notes, caption and OK button, focus is still not set to the dialog when it is shown. I would like the user to be able to dismiss the dialog box simply by pressing enter rather than having to click the OK button.

Is that possible?

I have not been able to reproduce this issue.
By default the Ok button should receive focus when the IWAdvMessageDialog is displayed.


Can you please let me know which IntraWeb version and browser you are using so I can further investigate this?

I have done some testing.

  • Just a form with a button, button displays the dialog using ShowAsync - works as expected.
  • A form with a region; dialog and button belong to the region - works as expected.
  • A form with a region; button belongs to the region, dialog belongs to the form - dialog does not receive focus when shown.

So I realise now I can solve this problem by placing the IWAdvMsgDlg on the region I am calling it from. However it would be nice to have just one IWAdvMsgDlg that I can use from multiple regions on the form. Is this possible?

Thanks.

Sorry, forgot to say I am using XE2, IW 12.1.26 and the current version of the TMS components.


I have not been able to reproduce this issue.
Can you please provide a ready to run sample project that demonstrates the issue so I can further investigate this?
(Sample projects can be sent to mailto:info@tmssoftware.com)
Can you also let me know which browser (name/version) you are using?
Bart Holvoet2012-04-11 03:18:26

Hi Bart,

I have tried this with a new application and the scenario I have described above does work as expected. Therefore it must be something else I have on the form. If I can narrow it down to something in particular I'll post again. In the meantime thanks for your help.