Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Wizard

Status
Not open for further replies.

nevets2001uk

IS-IT--Management
Jun 26, 2002
609
GB
I'm working on a program for use within our organisation. I have the basics working and would like to create some wizard tools to make the software easier to use.

I know how to do this but I was just hoping for a little advice on the forms. As I see it I could either create a seperate form for each page of the Wizard or 1 form with controls which hide when not required on the page.

What method would be best? I will have a lot of these wizards and so if I do go for seperate forms I'm likely to have a huge number of them in the program.

Thanks

Steve Gordon
 
Have you tried just using the Wizard wizard? It uses forms, but does all the hard bits for you. It's in Add-Ins (you may need to load it from Add-In Manager)

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Prefer to create my own. I try to avoid Microsoft Default stuff where possible! I need my Wizard to be a customised a fair bit. Do you know if that create a number of forms or just one though?
 
There are two options :
1. Create only form and create many frames which can be hidden and shown depending upon conditions. But having many frames say (15-20) is difficult to manage.
2.Create diff forms with same height and width , top and left .

According to me second option is a neat one .

Rest is ur choice.

Good luck
Vikram
 
A (IN MY OPINION) less cumbersome approach is the tab control. You can have as many "Tabs" as desired and set their height to zero, so they are not 'visible'. Use ["Next" | "Previous"] command buttons on each Tab and it becomes more-orless indistinguishable from the "Ms." ones.

BTW, WHY are you 'aginst' the Ms. Defaults? I have found that they are more generally maintainable (particularly in terms of version changes) than third party controls and thsy DO provide a framework for implementation which save a lot of time. So, I am QUITE curious re issues or problems which others see in their use.




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Nothing specific against the Microsoft Defaults. I do prefer to create my own forms etc because i find it easier to work with them and modify them later.

I find some of the MS Wizards for creating these elements can be quite restrictive and customisation can be a chore.

I've not worked with tabs before. Is there a tutorial that you know of that would help me get started?
 
The following code module will open a form within a form. You need to provide a site for it to live that has a hWnd property e.g. a picture box. The code will open a subform within the picturebox, resizing it to the correct dimensions. This means you can keep your outer form, swapping the inner form as appropriate.
Code:
Option Explicit
'Sub Forms Module Copyright 1998 Norrisoft
'
'This module exports a Public Sub OpenSubForm
'The sub takes two parameters : a form, and an hWnd property
'The form is loaded, it is setup as a child window, and then displayed
'in the hWnd window.
'
'Any object that has an hWnd may be used as the host for the form.
'This includes picture boxes, buttons, etc, etc .....
'
'NB: Within the host form you should unload any subforms loaded in the
'Form_Unload event !
'
'Now you can write wizards ! ....... happy coding.
'
'Norris68

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Sub SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)

Private Const GWL_STYLE = (-16)
Private Const GWL_HWNDPARENT = (-8)
Private Const WS_CHILD = &H40000000
Private Const HWND_TOP = 0&
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40

Public Sub OpenSubForm(SubForm As Form, HostHWND As Long)
Dim DispRec As RECT
Dim Style As Long

GetClientRect HostHWND, DispRec                         ' Get Display Rectangle dimensions
Load SubForm                                            ' Load subform
Style = GetWindowLong(SubForm.hwnd, GWL_STYLE)          ' Get current window style
Style = Style Or WS_CHILD                               ' Append "WS_CHILD" style to the hWnd window style
SetWindowLong SubForm.hwnd, GWL_STYLE, Style            ' Add new style to window
SetParent SubForm.hwnd, HostHWND                        ' Set host window as parent window
SetWindowLong SubForm.hwnd, GWL_HWNDPARENT, HostHWND    ' Save the hWnd Parent in hWnd's window struct.
                                                        ' Display the subform
SetWindowPos SubForm.hwnd, _
             HWND_TOP, 0&, 0&, DispRec.Right, DispRec.Bottom, _
             SWP_NOZORDER Or SWP_NOACTIVATE Or SWP_SHOWWINDOW
End Sub
 
I do not know of any 'tutorial' for the Tab Control. All I ever needed was available via the ubiquitous {F1{/b} (e.g. HELP). I do think there are some discussions of it in some of the third party publications, such as "QUE" or "SYBEX".




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top