I have created a username and password dialog for MaxGUI. Let me know what you think. I am currently working on more. (Let me know of any you would like. I'd be happy to put something together!)
Seb/Mark Tiffany: Could this be a possible addition to the ProxyGadgets module?
Seb/Mark Tiffany: Could this be a possible addition to the ProxyGadgets module?
Strict Import maxgui.maxgui 'Import maxgui.win32maxguiex 'CREATED BY KEDRIC SIDDONS' 'COPYRIGHT 2008 KEDRIC SIDDONS' Type TUserPassDialog Global _window:TGadget Global _usernamelab:TGadget Global _passwordlab:TGadget Global _usernamefield:TGadget Global _passwordfield:TGadget Global _okbutton:TGadget Global _username:String Global _password:String Function Create:String[](parent:TGadget,username:String="",password:String="") If parent=Null RuntimeError "TUserPassDialog: Need parent gadget!" End EndIf If GadgetClass(parent)<>GADGET_WINDOW RuntimeError "TUserPassDialog: Parent gadget must be a window!" End EndIf DisableGadget parent _window=CreateWindow(AppTitle,0,0,300,120,parent,WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS|WINDOW_CENTER) _usernamelab=CreateLabel("Username:",10,14,80,20,_window) _usernamefield=CreateTextField(90,10,ClientWidth(_window)-(90+10),20,_window) _passwordlab=CreateLabel("Password:",10,44,80,20,_window) _passwordfield=CreateTextField(90,40,ClientWidth(_window)-(90+10),20,_window,TEXTFIELD_PASSWORD) _okbutton=CreateButton("Submit",ClientWidth(_window)-(70+10),ClientHeight(_window)-(24+10),70,24,_window) ActivateGadget _usernamefield SetGadgetText _usernamefield,username SetGadgetText _passwordfield,password Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE Select EventSource() Case _window EnableGadget parent FreeGadget _window Return ["",""] Exit EndSelect Case EVENT_GADGETACTION Select EventSource() Case _okbutton _username=TextFieldText(_usernamefield) _password=TextFieldText(_passwordfield) If Len(_username)=0 Notify "Username required!",True Else If Len(_password)=0 Notify "Password required!",True Else EnableGadget parent FreeGadget _window Return [_username,_password] Exit EndIf EndIf EndSelect EndSelect Forever EndFunction EndType Rem bbdoc: Creates a username and password dialog. returns: A string array. Index 0 is username, index 1 is password EndRem Function RequestUsernamePassword:String[](parent:TGadget,username:String="",password:String="") Return TUserPassDialog.Create(parent,username,password) EndFunction Rem 'EXAMPLE' Global window:tgadget=CreateWindow("Dialog Test",50,50,640,480,Desktop(),1+2) Global button:tgadget=CreateButton("Dialog",10,10,80,24,window) Repeat WaitEvent() Select EventID() Case event_windowclose Select EventSource() Case window End EndSelect Case event_gadgetaction Select EventSource() Case button Local info:String[]=RequestUsernamePassword(window) Local username:String=info[0] Local password:String=info[1] If username="" And password="" Notify "Dialog closed.",True Else Notify "USERNAME: "+username+"~nPASSWORD: "+password,False EndIf EndSelect EndSelect Forever EndRem