forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Problem with dialog. Must click twice to close

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Sat Mar 08, 2003 3:16 am    Post subject: Problem with dialog. Must click twice to close Reply with quote

I'm experimenting with an email checking app here.
Anyways, I'm having some problems with the settings dialog I think.

Closing the settings dialog works fine, but when I click to close the main program using the x I have to click twice to close it.
Hope someone can help me find the problem.
Thanks in advance
Code:
external vdsipp.dll
INIFILE  OPEN, @path(%0)\pop.ini

  DIALOG CREATE,Just an experiment,-1,0,327,206
REM *** Modified by Dialog Designer on 08.03.2003 - 03:55 ***
  DIALOG ADD,BUTTON,CHECKMAIL,64,64,104,24,CHECKMAIL,Click to check your email.
  DIALOG SHOW
rem  DIALOG SELECT,0 

GoSub ReadINI

:Evloop
  wait event
  parse "%%Event;%D",@event(D)
goto %%Event


:CHECKMAILBUTTON
INTERNET POP3,CREATE,1
INTERNET POP3,THREADS,1,OFF
INTERNET POP3,AUTHENTICATE,1,%%UserName,%%Password
INTERNET POP3,CONNECT,1,%%MailServer,110
%R = @INTERNET(POP3,RETURNCODE,1)

If @equal(%R,1)
  %A = @INTERNET(POP3,MAILBOXSIZE,1)
  %B = @INTERNET(POP3,MSGCOUNT,1)
  If @equal(%B,0)
    WARN Sorry %%YourName. No emails on the server at this time.
  Else
    %A = @DIV(%A,1024)
    warn %%YourName, you have %B emails taking@cr()up %A kb on the %%MailServer server.
  End
Else
  warn Error connecting to server.@cr()Did you use the correct password?
End

rem We are finished using the connection, so now we disconnect and close it.
INTERNET POP3,DISCONNECT,1
INTERNET POP3,DESTROY,1
Goto Evloop

:EmailSettings
if @WinExists(Email account settings)
  Goto Evloop
Else
  DIALOG CREATE,Email account settings,-1,0,313,183,ONTOP
REM *** Modified by Dialog Designer on 08.03.2003 - 03:48 ***
  DIALOG ADD,GROUP,GROUP1,8,8,296,128,POP Email settings
  DIALOG ADD,TEXT,YOURNAME,40,16,,,Your name:
  DIALOG ADD,EDIT,EDIT1,32,112,176,21,,Enter your first name here.
  DIALOG ADD,EDIT,USERNAME,56,112,176,21,,Enter here your username to login to the email account.
  DIALOG ADD,TEXT,UNAME,64,16,,,Username:
  DIALOG ADD,EDIT,PASSWORD,80,112,176,21,,Enter the password used for loggin in to your mail account.
  DIALOG ADD,TEXT,PASSW,88,16,,,Password:
  DIALOG ADD,EDIT,SERVER,104,112,176,21,,Enter your email server here (mail.yourserver.com)
  DIALOG ADD,TEXT,Serv,112,16,,,Email server:
  DIALOG ADD,BUTTON,SAVE,144,56,80,32,Save
  DIALOG ADD,BUTTON,CANCEL,144,192,80,32,Cancel
  DIALOG SHOW
End
Goto Evloop

:ReadINI
  %%UserName = @INIREAD(Pop Settings,UserName,0)
  If @equal(%%UserName,0)
    Goto EmailSettings
  Else
    %%Password = @INIREAD(Pop Settings,PassWord,0)
  End
Exit

:SAVEBUTTON
  %%YourName = @dlgtext(EDIT1)
  %%UserName = @dlgtext(USERNAME)
  %%Password = @dlgtext(PASSWORD)
  %%MailServer = @dlgtext(SERVER)
  INIFILE WRITE,Pop Settings,YourName,%%YourName
  INIFILE WRITE,Pop Settings,UserName,%%UserName
  INIFILE WRITE,Pop Settings,Password,%%Password
  INIFILE WRITE,Pop Settings,MailServer,%%MailServer
  goto CLOSE

:CANCELBUTTON
  goto CLOSE

:CLOSE
  if @greater(%D,0)
    dialog select,%D
    dialog close
    wait event
    %E = @event()
    goto Evloop
  end
  exit

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Sat Mar 08, 2003 4:06 am    Post subject: Reply with quote

Kinda strange.
The program will show the settings dialog if the ini file haven't been created. If I close the settings dialog without entering anything and the I have to click twice to close the program.

But if I have entered the info in the settings dialog then the close button works. Could anyone help me please? Crying or Very sad

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Sat Mar 08, 2003 4:28 am    Post subject: Reply with quote

I'm sure that if you use "STOP" instead of "EXIT" on the end of the script, it will work.
I'm not sure why yet....
Back to top
View user's profile Send private message Send e-mail Visit poster's website
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Sat Mar 08, 2003 4:30 am    Post subject: Reply with quote

Yeah, that worked. Thanks Tommy
Now the obvious question is, WHY? Laughing
That was kinda strange. Anyways, thanks again Tommy.

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Sat Mar 08, 2003 4:31 am    Post subject: Reply with quote

Ok, the cause is, that you are first using GOSUB to go to ReadINI, and then inside that,
use a GOTO.

It is not allowed to use GOTO in a GOSUB, because that way the GOSUB is never left
using an EXIT command.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Sat Mar 08, 2003 4:32 am    Post subject: Reply with quote

What you might want to try to do, is to change "EmailSettings" into a gosub routine
as well. That way you could call it from ReadINI.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sat Mar 08, 2003 4:34 am    Post subject: Reply with quote

When it gets to the exit under the close event, it's actually exiting the ReadINI SUB. That's because you don't exit ReadINI if there is no username, you jump out of it to EmailSettings.
So, under DIALOG SHOW try this:
Code:

GoSub ReadINI
If @equal(%%UserName,0)
  Goto EmailSettings
END


And change the ReadINI SUB to this:
Code:

:ReadINI
  %%UserName = @INIREAD(Pop Settings,UserName,0)
  %%Password = @INIREAD(Pop Settings,PassWord,0)
  Exit

That should fix it for you.

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Sat Mar 08, 2003 4:35 am    Post subject: Reply with quote

Aaa I see, great. And again, thanks alot Tommy.
Can't find anything about in the helpfile though Wink

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sat Mar 08, 2003 4:36 am    Post subject: Reply with quote

Yikes, I see Tommy got to it a few times before I did. LoL
_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Sat Mar 08, 2003 4:45 am    Post subject: Reply with quote

He he thanks to both of you guys.
I change the EmailSettings into a sub routine and it worked great Smile Yiihhaaa.

While I'm here.
I've been looking at the email program Mac made. Very nice.
But I can't figure out how the program finds the id# of the mails.
What I want is to read the subject of the mail with the highest id number.
Probably isn't hard, but got really confused by the code Mac did in his program. Alittle out of my leage I guess.

I'm guessing this is where it finds the id number, but I can't figure out how that works Sad
Code:
  if @equal(@internet(pop3,connected,1),1)
     rem -- return the number of email messages on the server --
     DIALOG SET, Stat, CHECKING MAIL...
     %%msgcount = @internet(pop3,msgcount,1)
     if @greater(%%msgcount, 0)
        %%num = 1
        %m = ""
        REPEAT
          DIALOG SET, Stat, RETRIEVING MAIL %%num...
          INTERNET POP3,GETHEADER,1,%%num
          rem -- Wait for "POP31ONGETHEADERDONE" event, or 3 minutes... --
          WAIT EVENT,180
          if @equal(@event(),"POP31ONGETHEADERDONE")
             %m = %m@cr()@cr()From: @internet(pop3,from,1)@cr()Subject: @internet(pop3,subject,1)@cr()@internet(pop3,msgsize,1,%%num) bytes
             %%num = @succ(%%num)
          else
             %%num = "ERROR"
          end
        UNTIL @greater(%%num, %%msgcount)@equal(%%num, "ERROR")
     end
  else
     WARN Cannot connect to mail server...@tab()
     goto DESTROY
  end

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group