home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / database / informix / 2798 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  2.3 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!howland.reston.ans.net!paladin.american.edu!gatech!darwin.sura.net!spool.mu.edu!olivea!gossip.pyramid.com!pyramid!infmx!splinter!brownlow
  2. From: brownlow@informix.com (Keith Brownlow)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: Invisible entry
  5. Message-ID: <brownlow.724795533@splinter>
  6. Date: 19 Dec 92 20:05:33 GMT
  7. References: <1gt2stINN6c0@emory.mathcs.emory.edu>
  8. Sender: news@informix.com (Usenet News)
  9. Organization: Informix Software, Inc.
  10. Lines: 74
  11.  
  12. If your invisible attribute dosen't work, I have a suggestion that may work
  13. for entering a password. Start off by opening a form with a field the size 
  14. of the largest password you want to enter.  Then begin a loop with a prompt
  15. statement (PROMPT FOR CHAR).  Directly after the user 
  16. has entered a character of the password, add this character to string that 
  17. holds all the characters currently entered. Then display a symbol like 'X' 
  18. or '*' to the form field to show that input has been accepted.  When the user 
  19. presses return, the function is finished and you have a string containing the
  20. password.  You could have this function in a loop with a counter giving the 
  21. user x number of tries to get it right.  If you compile this knocked-up code
  22. below, it may solve your problem.
  23.  
  24.  
  25. DATABASE formonly
  26.  
  27. SCREEN
  28. {
  29. Enter a password
  30.   [f001    ]
  31. }
  32.  
  33. ATTRIBUTES
  34. f001 = formonly.form_mask;
  35. END
  36.  
  37.  
  38. FUNCTION get_passwd()
  39.  
  40. DEFINE
  41.    char_var CHAR(1),
  42.    secret_passwd CHAR(7),
  43.    mask_field CHAR(8),
  44.    counter SMALLINT
  45.  
  46. OPTIONS 
  47.    PROMPT LINE 1
  48.  
  49. OPEN WINDOW passwd_window AT 5,5
  50. WITH FORM "passwd"
  51. ATTRIBUTE(BORDER)
  52.  
  53. LET counter = 1
  54.  
  55. WHILE TRUE
  56.  
  57. PROMPT "" FOR CHAR char_var
  58.  
  59. IF char_var IS NULL THEN
  60.    EXIT WHILE
  61. ELSE
  62.    LET secret_passwd[counter,counter] = char_var 
  63.    LET mask_field[counter,counter] = "*" 
  64.    DISPLAY mask_field to form_mask
  65.    LET counter = counter + 1
  66. END IF
  67.  
  68. END WHILE
  69.  
  70. CLOSE WINDOW passwd_window
  71.  
  72. RETURN secret_passwd
  73.  
  74. END FUNCTION
  75.  
  76.  
  77. The only drawback to this function is that the cursor will be on the PROMPT
  78. line of the "" PROMPT statement, not on the form field.  If you can live with
  79. this, then otherwise, it is ok.  I used to use a function like this before the
  80. 4.1 release solved the INVISIBLE attribute problem, although I know a number
  81. of my clients have have upgraded to 4.1 and their termcap probs have not gone
  82. away.
  83.  
  84. Hope this helps some,
  85. Keith.
  86.