Hello,
The function SwitchToDialog() (similarly to other functions to control the Dialogs) performs transitions when showing/hidding the Dialogs. The transitions include the positioning of the Dialogs. Per default the Dialogs are positioned in the center of the available screen area or the area of the superior component. What you can do:
If you want the Dialog to appear at predetermined position, you have to customize the transition used to show the Dialog. With this you specify the area within it the Dialogs are aligned and how the Dialogs are aligned. For example, if you intend to simply show/hide the Dialog without performing any animations, then:
1. Create a new Show/Hide Transition object.
2. Configure in the properties of the object how this transition should arrange the Dialogs.
With these properties you specify the layout constraints. To arrange the Dialog at the precise X,Y position, configure the property Alignment of the transition object with the value Effects::DialogAlignment[ AlignHorzLeft, AlignVertTop ]. and the properties MarginLeft and MarginTop with the desired X, Y values.
3. Finally, you pass this object in the aPresentTransition parameter (the second parameter) when calling the SwitchToDialog() method.
You can create the transition object in-place immediately before you call the SwitchToDialog() method:
var Effects::ShowHideTransition transition = new Effects::ShowHideTransition;
transition.Alignment = Effects::DialogAlignment[ AlignHorzLeft, AlignVertTop ];
transition.MarginLeft = the_X_position;
transition.MarginTop = the_Y_position;
SwitchToDialog( the_dialog, transition, null, null, null, null, null, null, null, null, false );
Or , if the Dialog position does not change, you can add the transition object to the GUI component where you plan to present the Dialog and configure its properties in Inspector. The you simply pass the transition object in the parameter of the SwitchToDialog() method.
Hope it helps you further.
Best regards
Paul Banach