Thanks for the replies everyone!
So the fix was to turn statusbar into a box not a frame, use redraw() and
Fl::check().
You make a good point about threading Mike. The code I posted up was a part of
the server connect thread.
Now the whole GUI breaks. Whenever the server isn't running and the server
connect thread would change the status from nothing to "Connecting" to
"Unconnected - Unvalidated" and the thread exits everything is fine. But then
I start the server and it goes from nothing to "Connecting" to "Connected -
Validated" or "Connected - Unvalidated" and suddenly it breaks the whole GUI.
Each time its in a different way like stray lines or missing text or twice as
much text as there is supposed to be. Commenting out all the status updates
except Connecting fixes the issue. I guess I'll post up the whole thread and
see what y'all can see.
DWORD WINAPI ServerConnect( LPVOID lpParam )
{
sb->StatusBarGroup->label("Connecting...");
sb->StatusBarGroup->redraw();
Fl::check();
WSAStartup(MAKEWORD(1,1), &wsaData);
Socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
addr = getaddrinfo("127.0.0.1","27423", NULL, &res);
addr = connect(Socket, res->ai_addr, res->ai_addrlen);
if(addr == 0)
{
sb->StatusBarGroup->label("Unconnected - Unvalidated");
sb->StatusBarGroup->redraw();
Fl::check();
}
else if(addr == SOCKET_ERROR)
{
sb->StatusBarGroup->label("Unconnected - Unvalidated");
sb->StatusBarGroup->redraw();
Fl::check();
//connection fail error notify
return 0;
}
string * packet = new string;
*packet = packet_craft(1, 1);
x = send(Socket, packet->data(), packet->size(), 0);
if(x == SOCKET_ERROR)
{
sb->StatusBarGroup->label("WSA Error");
sb->StatusBarGroup->redraw();
Fl::check();
//Socket Error notify
return 0;
}
packet = new string;
*packet = recv_packet();
if(int(packet->at(4) == VERSION))
{
sb->StatusBarGroup->label("Connected - Validated");
sb->StatusBarGroup->redraw();
Fl::check();
connected = TRUE;
lg->lib->activate(); //Activate Login Button
}
else
{
sb->StatusBarGroup->label("Connected - Unvalidated");
sb->StatusBarGroup->redraw();
Fl::check();
//Version Check fail
}
return 0;
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk