At 12:31 16/05/2001 +1200, you wrote:
>Can you just enable /disable the button - not wonderful but a quick fix !!!

Actually, I think that is the best way to do it, especially from a GUI 
point of view - if you aren't allowed to use that button, it should be 
disabled.

So..
try
   btn.enabled := False
   connect..
   do stuff
finally
   btn.enabled := True;
end;

Of course that's only if your socket library is synchronous (like Indy - 
the one that I like & that now ships with D6), if it's asynchronous then 
it's a bit more complicated, but I've had to do just that with Asta - 
hourglass to normal cursor, all buttons disabled except the cancel button 
(which changes the mouse pointer to the normal one in the OnMouseMove 
event), and so on. It's a real pain to set everything back to normal (in 
all possible situations) when it's asynchronous. Use Indy: 
http://www.nevrona.com/Indy/

Ed

(also, I've never met a socket that liked being told to connect when it's 
already connected or trying to connect - although I've never used a NMHTTP 
component)



>Regards
>Paul McKenzie
>
>=========================
>Paul McKenzie
>Jetbet II Developer
>=========================
>[EMAIL PROTECTED]
>Ph: (04) 576-6822
>
>T.A.B. National Office
>106-110 Jackson Street
>Petone
>New Zealand
>
>
>
>____________________Reply Separator____________________
>Subject:  [DUG]:  NMHTTP
>Author:   [EMAIL PROTECTED]
>Date:          16/05/2001 12:02
>
>
>
>      I have a form with a button and a NMHTTP component.  When the
>      button is pressed the NMHTTP Get method is called.  I want the
>      application to not respond until that method has completed.  If I
>      double click the button I am getting an error saying that there is
>      a socket error because I am already connected.
>
>      What do I do to stop this?
>
>      Chrissy.
>
>
> 
>---------------------------------------------------------------------------
>          New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                        Website: http://www.delphi.org.nz
>      To UnSub, send email to: [EMAIL PROTECTED]
>      with body of "unsubscribe delphi"(See attached file: att1.eml)
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to