5
votes

I have some stuff in the OnShow event of a main form that fills a few listboxes with a procedure StuffLB. I need these listboxes refilled after any of my other forms have been shown with a call to ShowModal.

After such a modal form closes, the main form is just repainted there where the modal form was and its OnShow event does not fire.

The only way I can get the OnShow event to fire is by:

frmM.Hide;
frmB.ShowModal;
frmM.Show;

Is the only way I can get the listboxes filled to use the StuffLB call after every ShowModal call on sub forms? I have about 25 forms that are available.

I would had hoped that OnShow meant when it was shown again, either in part or in full.

I'd appreciate any help or suggestions.

1
You main form is clearly visible behind the modal form. OnShow fires when a form changes from hidden to visible.David Heffernan

1 Answers

9
votes

OnShow event fires when form becomes visible. What you may use is OnActivate event. However, since it is your code that calls ShowModal of another form, just put required code in a separate method and call here and in FormShow.