Platforms to show: All Mac Windows Linux Cross-Platform
/MacCocoa/SFPasswordAssistantMBS
Required plugins for this example: MBS MacBase Plugin, MBS MacExtras Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/SFPasswordAssistantMBS
This example is the version from Sun, 17th Mar 2012.
Project "SFPasswordAssistantMBS.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control txtPassword Inherits TextField
ControlInstance txtPassword Inherits TextField
End Control
Control lblMyPassword Inherits Label
ControlInstance lblMyPassword Inherits Label
End Control
Control btnPasswordAssistant Inherits PushButton
ControlInstance btnPasswordAssistant Inherits PushButton
EventHandler Sub Action()
If TargetMachO then
If myPassAss <> Nil Then
myPassAss.PerformClose()
myPassAss = Nil
me.Caption = "Show Password Assistant"
GetButton.Enabled=false
SetButton.Enabled=false
Else
me.Caption = "Close Password Assistant"
myPassAss = New MySFPasswordAssistantMBS
If myPassAss.Handle=0 Then
MsgBox "Password Assistant not available on this Mac OS X version."
Return
else
GetButton.Enabled=true
SetButton.Enabled=true
myPassAss.ShowPanel()
myPassAss.Title="Choose a Password" //Must be called after ShowPanel()
'myPassAss.Top = Screen(0).Height-myPassAss.Height //Top is distance in pixels from the bottom of the screen
myPassAss.Left = 500
End If
End If
Else
MsgBox "SFPasswordAssistantMBS only available on Mac OS X."
End If
End EventHandler
End Control
Control GetButton Inherits PushButton
ControlInstance GetButton Inherits PushButton
EventHandler Sub Action()
txtPassword.text=myPassAss.Password
End EventHandler
End Control
Control SetButton Inherits PushButton
ControlInstance SetButton Inherits PushButton
EventHandler Sub Action()
myPassAss.Password=txtPassword.text
End EventHandler
End Control
Control btnPasswordAssistant1 Inherits PushButton
ControlInstance btnPasswordAssistant1 Inherits PushButton
EventHandler Sub Action()
if myPassAss <> nil then
myPassAss.BaseWindowWillClose
myPassAss = nil
end if
End EventHandler
End Control
EventHandler Sub Close()
if myPassAss<>nil then
myPassAss.BaseWindowWillClose
end if
End EventHandler
Property myPassAss As SFPasswordAssistantMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MySFPasswordAssistantMBS Inherits SFPasswordAssistantMBS
EventHandler Sub TextChanged(text as string)
window1.txtPassword.text=text
End EventHandler
End Class
End Project
The items on this page are in the following plugins: MBS MacCocoa Plugin.