Board index » delphi » TPageControl and TTabSheet problem

TPageControl and TTabSheet problem

Hi,

I've got an annoying problem when I try to change from one tag to another
specific tab.
It's always that single tab that causes the error.

The tab button becomes highlighted but then nothing happens, I can't change
to another tab...
This occurs when a user has connected to my TCP server - when the user
connects a TListView component on this specific tav is updated.
I don't get this error if no user has connected.

There is no code executed when I change tabs - except the one inherited by
the TPageControl component.

Anyone got any ideas? If you want to know anything else, please ask for the
information. I can't think of anything more that could be of use right now.

Thanks in advance

 

Re:TPageControl and TTabSheet problem


Fredrik,

    Is this on the server or on the client?  In either case are you
"synchronizing" the changes to the listview items with the main thread from
your socket code?  If on the client, are you having the application wait
until you get a response from the server with an event.waitfor or something?
Many issues to look at outside the page control when dealing with sockets,
threads and display :)

Mike B.

Re:TPageControl and TTabSheet problem


Its on the server.
I don't syncronize because I don't know which thread to syncronize from -
the code is in the OnExecute event of the TidTCPServer component.

// Fredrik

Quote
"Mike B." <mb...@wi.rr.com> wrote in message

news:3ee474e8$1@newsgroups.borland.com...
Quote
> Fredrik,

>     Is this on the server or on the client?  In either case are you
> "synchronizing" the changes to the listview items with the main thread
from
> your socket code?  If on the client, are you having the application wait
> until you get a response from the server with an event.waitfor or
something?
> Many issues to look at outside the page control when dealing with sockets,
> threads and display :)

> Mike B.

Re:TPageControl and TTabSheet problem


Fredrik,

    It sounds like you're using the "Indy" components ("TId").  Not familiar
with them.  But to me, it sounds like that's your issue.  If nothing else
use a "SendMessage" to your main form to synchronize. ex:

const
  MF_AddItem = WM_USER + 100;

type
TMainForm = class(TForm)
  lvMain : TListview;
...
procedure AddItemsToListView(Msg : TMessage); message MF_AddItem;
end;

procedure AddItemsToListView(Msg : TMessage);
begin
  with lvMain.Add do
    Caption:=String(Msg.LParam);
end;

in your TCP socket reading

SendMessage(MainForm.Handle,MF_AddItem,0,LongInt(PChar('New Connection
Name')));

HTH,

Mike B.

Re:TPageControl and TTabSheet problem


Thanks for the tip - I'll use it if I can't solve it another way.

// Fredrik

Quote
"Mike B." <mb...@wi.rr.com> wrote in message

news:3ee489f2$1@newsgroups.borland.com...
Quote
> Fredrik,

>     It sounds like you're using the "Indy" components ("TId").  Not
familiar
> with them.  But to me, it sounds like that's your issue.  If nothing else
> use a "SendMessage" to your main form to synchronize. ex:

> const
>   MF_AddItem = WM_USER + 100;

> type
> TMainForm = class(TForm)
>   lvMain : TListview;
> ...
> procedure AddItemsToListView(Msg : TMessage); message MF_AddItem;
> end;

> procedure AddItemsToListView(Msg : TMessage);
> begin
>   with lvMain.Add do
>     Caption:=String(Msg.LParam);
> end;

> in your TCP socket reading

> SendMessage(MainForm.Handle,MF_AddItem,0,LongInt(PChar('New Connection
> Name')));

> HTH,

> Mike B.

Other Threads