'File source from OnClickSoftware
' QLoginManager, version 1.0
Declare Function QLoginManager_SetFocus lib "user32" alias "SetFocus" (hWnd&) as long
Declare Function QLoginManager_GetFocus lib "user32" alias "GetFocus" () as long
Declare Sub QLoginManager_OnSubmitEvent
Declare Sub QLoginManager_OnAccessLevelChangeEvent
Type QLoginManager extends QObject: With This
Private:
DlgForm as QForm
UserLabel as QLabel
UserEdit as QEdit
PassLabel as QLabel
PassEdit as QEdit
ConfirmLabel as QLabel
ConfirmEdit as QEdit
AccessLabel as QLabel
AccessCombo as QComboBox
OKButton as QButton
CancelButton as QButton
Public:
Caption as string Property Set SetCaption
Property Set SetCaption(Caption as string)
.DlgForm.Caption=Caption
End Property
TextLength as string Property Set SetTextLength
OnSubmit as Event(QLoginManager_OnSubmitEvent)
OnAccessLevelChange as Event(QLoginManager_OnAccessLevelChangeEvent)
Subi AddAccessLevels(...)
Dim i as integer, Type$ as string
For i=1 to ParamStrCount: Type$=" "+LTrim$(RTrim$(ParamStr$(i)))
If Type$=" " Then Type$=" [Undefined]"
.AccessCombo.AddItems(Type$)
If i=1 Then .AccessCombo.ItemIndex=0
.AccessCombo.DropDownCount=ParamStrCount
Next i
End Subi
Sub Show
.DlgForm.ShowModal
End Sub
Event DlgForm.OnKeyDown(Key as word, Shift as integer)
Dim ActiveField as long
If Shift=16 Then 'AltDown
If Key=85 Then 'U
ActiveField=.UserEdit.Handle
ElseIf Key=80 Then 'P
ActiveField=.PassEdit.Handle
ElseIf Key=76 Then
ActiveField=.AccessCombo.Handle
End If
If QLoginManager_GetFocus()<>ActiveField Then QLoginManager_SetFocus(ActiveField)
End If
End Event
Constructor
.DlgForm.Width=270
.DlgForm.Height=170
.DlgForm.Caption="Please Log In"
.DlgForm.BorderStyle=3
.DlgForm.KeyPreview=1
.DlgForm.Center
UserLabel.Caption="&Username:"
UserLabel.Top=19
UserLabel.Left=13
UserLabel.Parent=.DlgForm
UserEdit.Top=16
UserEdit.Left=UserLabel.Left+92
UserEdit.Width=.DlgForm.ClientWidth-(.UserEdit.Left+14)
UserEdit.Parent=.DlgForm
PassLabel.Caption="&Password:"
PassLabel.Top=UserLabel.Top+51
PassLabel.Left=13
PassLabel.Parent=.DlgForm
PassEdit.PasswordChar="*"
PassEdit.Top=.PassLabel.Top-4
PassEdit.Left=.PassLabel.Left+79
PassEdit.Width=.DlgForm.ClientWidth-(.PassEdit.Left+14)
PassEdit.Parent=.DlgForm
PassLabel.Caption="&Password:"
PassLabel.Parent=.DlgForm
AccessLabel.Caption="Access &Level:"
AccessLabel.Top=.PassLabel.Top+63
AccessLabel.Left=.PassLabel.Left
AccessLabel.Parent=.DlgForm
AccessCombo.Top=.AccessLabel.Top-4
AccessCombo.Left=.AccessLabel.Left+79
AccessCombo.Width=.DlgForm.ClientWidth-(.AccessCombo.Left+13)
AccessCombo.Style=2 'csDropDownList
AccessCombo.Parent=.DlgForm
End Constructor
End With: End Type
Dim LoginManager as QLoginManager
LoginManager.AddAccessLevels("Standard (Default)", "Guest", "Administrator")
LoginManager.Show