Re: win32lib main window

new topic     » goto parent     » topic index » view thread      » older message » newer message

Ah yes, the style values for showWindow() are not the same as for WinMain() (bonus: openWindow() actually accepts the styles from either function!)

When in doubt, always check the docs. Win32Lib documentation is quite helpful. smile

Win32Lib docs said...

showWindow ( window, style )

Shows a window according to the style

Category: Attributes

window is either a control id or the name of a Window control.

The style flag is one of those in this list.

  • SW_HIDE = 0
  • SW_SHOWNORMAL = 1
  • SW_NORMAL = 1
  • SW_SHOWMINIMIZED = 2
  • SW_SHOWMAXIMIZED = 3
  • SW_MAXIMIZE = 3
  • SW_SHOWNOACTIVATE = 4
  • SW_SHOW = 5
  • SW_MINIMIZE = 6
  • SW_SHOWMINNOACTIVE = 7
  • SW_SHOWNA = 8
  • SW_RESTORE = 9
  • SW_SHOWDEFAULT = 10
  • w32FullScreen = "fullscreen"

Example:

showWindow(formErrors, SW_HIDE)
showWindow("Message List", SW_RESTORE)

Win32Lib docs said...

WinMain ( window, style )

Run event loop.

Category: System Attributes

This is the main processing loop for Win32Lib. Call WinMain after all the controls and their handlers have been defined for the initial running of the application.

The main window is set to window. When window is closed, the application is shut down. Note that if window is -1 then the first window defined is used as the primary window.

If you wish to have an application that has no window under the control of win32lib, but still wish to use its Windows Message loop, then set window as 0.

The style flag is one of the following:

  • Normal: Original size.
  • Minimized: Minimized into the task bar.
  • Maximized: Fills the client area of the screen.

The WinMain function will open the application's main window.

It it possible to specify the control that will get the initial focus when the window opens. See openWIndow for details.

For example:

-- set MyWindow as main window, open normally
-- with the initial focus on the Login button.
WinMain( {MyWindow, btnLogin}, Normal )

Win32Lib docs said...

openWindow ( window, style )

Opens a window

Category: Attributes

window is either a control id, a two-element sequence containing {control id, focus id}, or the name of a Window control.

If window is a Window then the style flag is one of the following:

  • Normal: Original size.
  • Minimize: Minimized into the task bar.
  • Maximize: Fills screen.
  • Modal: Original size, but no other application window can get focus until this window is closed. Use to emulate modal dialogs.
  • Win32 Flag: For example, SW_SHOWMINNOACTIVE.

The openWindow function will trigger an w32HOpen event before it is opened and a w32HActivate event after it is opened. If the w32HOpen event calls returnValue(-1), the window is not opened.

It it possible to specify the control that will get the initial focus when the window opens. To do this, the window parameter must be specified in the form {window_id, focus_id}. If the focus_id is zero, then the first Edit type control is given focus. If there are no edit boxes, then the first button type control is given focus. If you don't specify the initial focus control, then the control that last had focus in the window is used.

Example:

-- Open the Login window, giving focus to the User ID field.
openWindow({formLogin txtUserId}, Normal)

-- Open the Messages window.
openWindow("Message List", Normal)

-- Open an input form
openWindow(vPromptCust, {"Name","<unknown>"} )

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu