🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1351

Re: socket issue

#1351
From: Remy Lebeau (TeamB)
Date: Sun, 11 Feb 2007 21:36
41 lines
2272 bytes
"mat" <mat@hotmail.com> wrote in message
news:45ce03ae$1@newsgroups.borland.com...

> if i dont call this in the thread when i want to show something in
> a label in the main thread(form) then it doesnt show up

You are not supposed to be updating the controls of the main thread
from within the context of a worker thread to begin with.  For a
worker thread to safely access the UI, it should be using the
TThread::Synchronize() method for that.  This is clearly stated at the
top of every unit that the IDE generates when you choose the "File |
New | Thread" wizard.  For example:

    void __fastcall TWorkerThread::Execute()
    {
        //...
        Synchronize(UpdateUI);
        //...
    }

    void __fastcall TWorkerThread::UpdateUI()
    {
        MainForm->Label1->Caption = "connecting...";
        DataModule->SocketConnection1->Connected = true;
    }

> concerning the sychronous-asychronous mode,i dont know how
> to change this in the component im using.

You still haven't said which component you are actually using.  I
asked you that question in my last reply.

> i have created a thread to do the connecting but this new thread
> accesses a component(socket connection)from a datamodule.is
> this the reason that it forces the program to freeze?

No.


Gambit
Technical Details
Message-ID: <45cf8c6a$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45cbd7c8$1@newsgroups.borland.com> <45ccbf29$1@newsgroups.borland.com> <45ce03ae$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,54a50302c070b08c
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <45cbd7c8$1@newsgroups.borland.com> <45ccbf29$1@newsgroups.borland.com> <45ce03ae$1@newsgroups.borland.com>
Subject: Re: socket issue
Date: Sun, 11 Feb 2007 13:36:15 -0800
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.83.34.171
Message-ID: <45cf8c6a$2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1171229802 75.83.34.171 (11 Feb 2007 13:36:42 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail