Activate window
Posted: 12 Feb 2016 21:40
If you have more than one window showing, say FormA and Form B, how can you make one rather than the other active under program control (as you can manually with mouse clicks)?
If you mouse click on such a window, say FormA the previously active window (say FormB) receives the deactive event and the window you click, FormA get the active event. (Now if FormA has its own menu, then that menu will appear.)
The obvious solution you would expect would be to use vpi::winPostEvent to send the e_active event for FormA. Sadly that is forbidden and so the following (superficially plausible code fragment) gives a run time error:
%The menu of FormA is only visible when FormA is active
%and we want it to show! So:
%set em up:
Window=FormA,
WindowHandle = Window:getVPIWindow(),
Event= vpiDomains::e_Activate,
%ready to rock! so go for it!:-
vpi::winPostEvent (WindowHandle, Event) ,
%RATS! the following line cuase a runtime error: the e_Activate event is proscribe with vpi::winPostEvent (its actually documented thus)
so how CAN you activate a given Windows, (FormA in the above example) (just as though you had mouse clicked it?)
If you mouse click on such a window, say FormA the previously active window (say FormB) receives the deactive event and the window you click, FormA get the active event. (Now if FormA has its own menu, then that menu will appear.)
The obvious solution you would expect would be to use vpi::winPostEvent to send the e_active event for FormA. Sadly that is forbidden and so the following (superficially plausible code fragment) gives a run time error:
%The menu of FormA is only visible when FormA is active
%and we want it to show! So:
%set em up:
Window=FormA,
WindowHandle = Window:getVPIWindow(),
Event= vpiDomains::e_Activate,
%ready to rock! so go for it!:-
vpi::winPostEvent (WindowHandle, Event) ,
%RATS! the following line cuase a runtime error: the e_Activate event is proscribe with vpi::winPostEvent (its actually documented thus)
so how CAN you activate a given Windows, (FormA in the above example) (just as though you had mouse clicked it?)