New topic: Need to create delay between actions?
<http://forums.realsoftware.com/viewtopic.php?t=34215> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message writer Post subject: Need to create delay between actions?Posted: Thu Jun 10, 2010 12:27 pm Joined: Wed Jan 31, 2007 9:01 am Posts: 223 Location: Saratoga Springs, NY area Hi, I'm continuing to work on a mail project based on the SMTP/PoP3 example that ships with RB. Instead of asking the user to re-enter their username, password, server, etc. data each time they open the program, I am trying to set up a Settings window. In this Settings window, they can enter this data once, it's encrypted using the crypto DLL used elsewhere in the program, saved to text file (TextOutputStream) then upon re-opening the program (default window = Settings), the Settings text fields are re-populated by reading from the text file (TextInputStream). Since the data is encrypted, I tried to set up both reading data and decrypting it, then re-populating the fields, in the Setting window's open event. Won't work (tried many different ways). Yet, if I separate these 2 actions, it works OK: use the open event to read/re-populate the encrypted data into the fields, then separately click a button with the decryption action. The fields turn from encrypted to decrypted and the clear text displays. I've wondered if putting all together in the open event goes too quickly. So, I tried a delay (using 5 ticks), but this made no difference. I separated the 2 actions by placing the read back into the app open event, then using the window open event for decryption. Won't work. Seems the window's open event can only read/re-populate the fields, and only a separate button with a separate action can decrypt the field's text. The significant code follows (won't work in same open event, will work if separated): read: Code: Dim t as TextInputStream dim f4 as folderitem = GetFolderItem ("C:\Users...text3.txt") If f4 <> Nil then t=TextInputStream.Open(f4) TextFieldUserName.text=t.ReadLine TextFieldPassword.text=t.ReadLine TextFieldSMTP.text=t.ReadLine TextFieldFrom.text=t.ReadLine TextFieldPoP3.text=t.ReadLine TextFieldFilter.text=t.ReadLine TextFieldn.text=t.ReadLine t.Close End if Decrypt Code:Declare Function DecryptString Lib "crypto.dll" (EInString as CString, Key as CString ) as CString TextFieldUserName.text = DecryptString ( TextFieldUserName.text, result3 ) TextFieldPassword.text = DecryptString ( TextFieldPassword.text, result3 ) TextFieldSMTP.text = DecryptString ( TextFieldSMTP.text, result3 ) TextFieldFrom.text = DecryptString ( TextFieldFrom.text, result3 ) TextFieldPoP3.text = DecryptString ( TextFieldPoP3.text, result3 ) TextFieldFilter.text = DecryptString ( TextFieldFilter.text, result3 ) TextFieldn.text = DecryptString ( TextFieldn.text, result3 ) if TextFieldn.text = "True" then authenticateBox2.value = true end if Any suggestions appreciated. _________________ writer Windows 7 Home Premium 64 bit, Core i7, 8G RAM, ATI Radeon HD5770, Release 2010-2 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
