Displays a hidden window and adjusts the size to account for the theme.

Syntax


Size = SRP_Show_Window(Window, Parent, Horizontal, Vertical, VisibleState, OrigMetrics, Adjust, AdjustMDIClient, Size, Position)


Returns

The window's new size.

Parameters

ParameterDescription
WindowThe fully qualified name of the window to be shown
ParentThe fully qualified name of the window's parent
HorizontalThe window's horizontal position
VerticalThe window's vertical position
VisibleStateThe window's new visible state
OrigMetricsThe theme metrics in which the window was designed
AdjustDetermines if the window should be adjusted to the current theme
AdjustMDIClientDetermines if the window's MDI client control should be adjusted to the current theme
SizeThe window size to be used in lieu of the window's current SIZE property
PositionDetermines whether or not the window is to be positioned

Remarks

This routine is usually called during the CREATE event of the current window. Current window should be invisible at design time so the movement of the window won't be seen by the end user. Simply pass the window's fully qualified name to the Window parameter. The remaining parameters are described in more detail below.

Parent

This is the fully qualified name of the window’s parent; the positioning will be relative to it. If the parameter is null, or unassigned, the subroutine will lookup the window’s parent for you; and if no parent is found, the window will be positioned against the screen. You may position the window against any other window (even if its not this one’s parent) by specifying it in this parameter. If you want to position relative the screen, then specify “SYSTEM” as the Parent.

Horizontal

Horizontal positioning. The possible values are:

ValueDescription
LxLeft justified to the parent. Set x to specify the offset amount from the parent’s left edge. Leave x blank if no offset is desired
CCenter justified to the parent
RxRight justified to the parent. Set x to specify the offset amount from the parent’s right edge. Leave x blank if no offset is desired

Vertical

Horizontal positioning. The possible values are:

Title FieldDescription
TxTop justified to the parent. Set x to specify the offset amount from the parent’s top edge. Leave x blank if no offset is desired
CCenter justified to the parent
BxBottom justified to the parent. Set x to specify the offset amount from the parent’s

bottom edge. Leave x blank if no offset is desired

VisibleState

The window’s new visible state. This value can be any value acceptable to the VISIBLE property of a window. SRP_Show_Window will use this value when making the window visible. Optionally, you can set this value to 0 if you want to adjust the window's size and position without showing it.

OrigMetrics

The theme metrics in which the window was designed. The OrigMetrics parameter is a dynamic array with the following structure:

<1> Caption Height – Height, in pixels, of the title bar (Windows Classic is 20)

<2> Menu Height – Height, in pixels, of the menu bar (Windows Classic is 19)

<3> Thin Frame Width – Width, in pixels, of a thin window's border (Windows Classic is 3)

<4> Thin Frame Height – Height, in pixels, of a thin window's border (Windows Classic is 3)

<5> Thick Frame Width – Width, in pixels, of a thick window's border (Windows Classic is 4)

<6> Thick Frame Height – Height, in pixels, of a thick window's border (Windows Classic is 4)

If you created your forms in Windows Classic theme, then you can omit this parameter or set it to “”.

SRP Utilities includes the handy SRP_METRICS_VIEWER tool. This simply tool shows the systems current measurements. You can use it to determine the metrics of your development system (incase they are standard).

For your convenience, the read only EDITLINE at the bottom allows you to copy and paste the current metrics directly into the OrigMetrics parameter.

Adjust

Older versions of OpenInsight save the absolute size and position of their forms. This can be a problem when the developer saves the form using one Windows theme, and the user opens the form in a different theme. If theme sizes differ, then the window may not appear as designed. Since OpenInsight 7.1, forms save the client size only, ignoring the developer's theme. When the user opens the form, the absolute size is calculated based on the current theme and the form's saved client size.

Adjust the window to the current theme if set to 1. By default, this parameter is always 1, so you only have to set this parameter if you want to turn off window adjustment or if you need to set the next parameter

AdjustMDIClient

Adjust the window’s MDI client control if set to 1. By default, this parameter is also always 1, so you only have to set this parameter if you do not want your window’s MDI Client control adjusted. This parameter compensates for the fact that MDI Client controls do not auto size during window creation, so they have to be manually adjusted. Set this parameter to 0 if your MDI client is meant to be a fixed size.

Size

By default, SRP_Show_Window uses the window's current SIZE property to perform its calculations. You can override that default by supplying your own size values via this parameter.

Position

In some cases, you may not want the position to be adjusted at all. Leaving the Horizontal and Vertical parameters blank is not enough to avoid repositioning. You must set this property to 0 if you want avoid any repositioning. By default, this parameter is 1.

Examples

* Just show the window
SRP_Show_Window(@Window)

* Show the window centered on the screen
SRP_Show_Window(@Window, "SYSTEM", "C", "C")

* Show the window at the top left corner of the screen
SRP_Show_Window(@Window, "SYSTEM", "L", "T")

* Show the window 100 pixels from the top left corner of the screen
SRP_Show_Window(@Window, "SYSTEM", "L100", "T100")

* Show the window relative to the bottom left corner of another window
SRP_Show_Window(@Window, "MY_WINDOW", "L", "B")

* Show a window developed in the default Windows XP theme
SRP_Show_Window(@Window, "SYSTEM", "C", "C", 25:@FM:21:@FM:3:@FM:3:@FM:4:@FM:4)
  • No labels