Password generator: Difference between revisions

Content added Content deleted
No edit summary
Line 2,098: Line 2,098:
<syntaxhighlight lang="futurebasic">
<syntaxhighlight lang="futurebasic">
output file "Password Generator"
output file "Password Generator"

include "Tlbx GameplayKit.incl"
include "Tlbx GameplayKit.incl"


Line 2,123: Line 2,122:
_window = 1
_window = 1
begin enum output 1
begin enum output 1
_optionsLabel
_pwLengthLabel
_pwLengthField
_pwAmountLabel
_pwAmountField
_passwordScroll
_passwordScroll
_passwordView
_passwordView
_offscreenPrintView
_offscreenPrintView
_createPasswordsBtn
_optionsHelp
_optionsHelp
_checkOmitIs
_checkOmitIs
Line 2,139: Line 2,132:
_charactersLongLabel
_charactersLongLabel
_passwordLengthField
_passwordLengthField
_pwAmountLabel
_pwAmountField
_seedLabel
_seedLabel
_seedField
_seedField
_saveBtn
_printBtn
_helpBtn
_helpBtn
_bottomLine
_bottomLine
_saveBtn
_printBtn
_createPasswordsBtn
end enum
end enum


Line 2,153: Line 2,149:


_savePanel = 1
_savePanel = 1
_helpAlert = 1
_pwLenAlert = 2
_pwLenAlert = 2


Line 2,176: Line 2,171:


void local fn BuildWindow
void local fn BuildWindow
long tag
CGRect r = fn CGRectMake( 0, 0, 672, 460 )
CGRect r = fn CGRectMake( 0, 0, 672, 460 )
window _window, @"Rosetta Code Password Generator", r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable
window _window, @"Rosetta Code Password Generator", r//, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable
WindowSetContentMinSize( _window, fn CGSizeMake(310,386) )
r = fn CGRectMake( 20, 73, 515, 370 )
r = fn CGRectMake( 20, 73, 515, 370 )
scrollview _passwordScroll, r, NSLineBorder,,_window
scrollview _passwordScroll, r, NSLineBorder,,_window
ViewSetAutoresizingMask( _passwordScroll, NSViewWidthSizable + NSViewHeightSizable )
textview _passwordView, r, _passwordScroll,, _window
textview _passwordView, r, _passwordScroll,, _window
Line 2,237: Line 2,236:
ControlSetFormat( _seedField, @"0123456789", YES, 6, 0 )
ControlSetFormat( _seedField, @"0123456789", YES, 6, 0 )
ViewSetToolTip( _seedField, @"Enter optional random seed number." )
ViewSetToolTip( _seedField, @"Enter optional random seed number." )
for tag = _optionsHelp to _seedField
ViewSetAutoresizingMask( tag, NSViewMinXMargin + NSViewMinYMargin )
next
r = fn CGRectMake( 631, 70, 25, 25 )
button _helpBtn, YES,,, r, NSButtonTypeMomentaryLight, NSBezelStyleHelpButton, _window
ViewSetToolTip( _helpBtn, @"Click for application help instructions." )
ViewSetAutoresizingMask( _helpBtn, NSViewMinXMargin + NSViewMaxYMargin )
r = fn CGRectMake( 20, 55, 632, 5 )
r = fn CGRectMake( 20, 55, 632, 5 )
box _bottomline,, r, NSBoxSeparator
box _bottomline,, r, NSBoxSeparator
ViewSetAutoresizingMask( _bottomline, NSViewWidthSizable + NSViewMaxYMargin )
r = fn CGRectMake( 522, 15, 131, 32 )
r = fn CGRectMake( 20, 15, 62, 32 )
button _createPasswordsBtn, YES, , @"Create passwords", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
button _printBtn, YES, , @"Print…", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
ViewSetAutoresizingMask( _printBtn, NSViewMaxXMargin + NSViewMaxYMargin )
r = fn CGRectMake( 91, 15, 62, 32 )
r = fn CGRectMake( 91, 15, 62, 32 )
button _saveBtn, YES, , @"Save…", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
button _saveBtn, YES, , @"Save…", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
ViewSetAutoresizingMask( _saveBtn, NSViewMaxXMargin + NSViewMaxYMargin )
r = fn CGRectMake( 20, 15, 62, 32 )
r = fn CGRectMake( 522, 15, 131, 32 )
button _printBtn, YES, , @"Print…", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
button _createPasswordsBtn, YES, , @"Create passwords", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
ViewSetAutoresizingMask( _createPasswordsBtn, NSViewMinXMargin + NSViewMaxYMargin )
r = fn CGRectMake( 631, 70, 25, 25 )
button _helpBtn, YES,,, r, NSButtonTypeMomentaryLight, NSBezelStyleHelpButton, _window
ViewSetToolTip( _helpBtn, @"Click for application help instructions." )
end fn
end fn


Line 2,400: Line 2,408:
end fn
end fn


// Build character arrays at launch and save as application property

void local fn CreateCharactersDictionary
void local fn CreateCharactersDictionary
CFArrayRef charArray = @[¬
CFArrayRef charArray = @[¬
Line 2,460: Line 2,468:
{{output}}
{{output}}
[[File:Password Generator.png]]
[[File:Password Generator.png]]




=={{header|Gambas}}==
=={{header|Gambas}}==