Search found 67 matches

by silver.moon
Sat Oct 31, 2015 6:57 am
Forum: C++ Development
Topic: Change the color of wxCheckBox text while disabled ?
Replies: 2
Views: 849

Re: Change the color of wxCheckBox text while disabled ?

I assume you tried SetForegroundColour and it didn't work? In that case, you'll probably have to use a text-less wxCheckBox plus an additional wxStaticText (hopefully you can change its text color). Great Idea! SetForegroundColour does change the color of of the wxCheckBox text, but only for the "e...
by silver.moon
Wed Oct 28, 2015 12:16 pm
Forum: C++ Development
Topic: Change the color of wxCheckBox text while disabled ?
Replies: 2
Views: 849

Change the color of wxCheckBox text while disabled ?

I have a wxcheckbox on a wxpanel.

I want the color of wxcheckbox text to look different in the disabled state.
How ?
by silver.moon
Sat Oct 03, 2015 3:55 am
Forum: C++ Development
Topic: Important note for documentation of wxThread::Delete
Replies: 2
Views: 498

Re: Important note for documentation of wxThread::Delete

Thanks, I see it now.

I just looked at the function signature, "wxThreadWait waitMode = wxTHREAD_WAIT_BLOCK" so thought that its using block mode.
But looks like I need to specify it, on MSW
by silver.moon
Sat Oct 03, 2015 3:50 am
Forum: C++ Development
Topic: Should you call Wait on a wxThreadHelper joinable thread that has stopped
Replies: 8
Views: 1947

Re: Should you call Wait on a wxThreadHelper joinable thread that has stopped

@DenDev

Yes, you are right.
I was actually calling Wait, after already calling Delete, which was causing the error dialog.
by silver.moon
Sat Oct 03, 2015 3:18 am
Forum: C++ Development
Topic: Important note for documentation of wxThread::Delete
Replies: 2
Views: 498

Important note for documentation of wxThread::Delete

While working with threads and wxThread::Delete I came across a strange behaviour. That is, if you call Delete in some event handler, while that handler has not yet finished, other events are getting processed. void MyClass::OnEvent() { print 1; m_thread->Delete(); print 2; } void MyClass::OnAnother...
by silver.moon
Fri Oct 02, 2015 12:26 pm
Forum: C++ Development
Topic: What happens if CreateThread is called again and again in wxThreadHelper
Replies: 9
Views: 1365

Re: What happens if CreateThread is called again and again in wxThreadHelper

I am wondering how reliable "IsRunning" is Going by your snippet ... bool YourClass::IsBusy() { if(GetThread() && GetThread()->IsRunning()) { return true; } return false; } By the time you are inside the "if block" the thread might have finished running, and you might still return true. For a long t...
by silver.moon
Fri Oct 02, 2015 12:21 pm
Forum: C++ Development
Topic: Should you call Wait on a wxThreadHelper joinable thread that has stopped
Replies: 8
Views: 1947

Re: Should you call Wait on a wxThreadHelper joinable thread that has stopped

1) You should not call the Wait() function if the thread has already been released. Before you call the Wait() function you must check that the wait operation is valid or you might get into trouble. Incase of JOINABLE threads inside wxThreadHelper "its released" only in wxThreadHelper destructor. S...
by silver.moon
Fri Oct 02, 2015 9:46 am
Forum: C++ Development
Topic: How to construct wxImage from jpg image data
Replies: 1
Views: 486

Re: How to construct wxImage from jpg image data

Okay, found the answer here https://forums.wxwidgets.org/viewtopic.php?t=18325 unsigned char* jpegData; // JPEG data buffer size_t jpegLen; // Length in bytes/chars of the JPEG data buffer wxMemoryInputStream jpegStream(jpegData, jpegLlen); wxImage jpegImage; jpegImage.LoadFile(jpegStream, wxBITMAP_...
by silver.moon
Fri Oct 02, 2015 9:30 am
Forum: C++ Development
Topic: What happens if CreateThread is called again and again in wxThreadHelper
Replies: 9
Views: 1365

Re: What happens if CreateThread is called again and again in wxThreadHelper

@evstevemd @doublemax No, I am not trying to spawn multiple threads at the same time. A new thread is started only after the previous one has finished running. So in that context, should the previous wxThread object be used ? Call Run() again. or CreateThread be called again to create a new wxThread...
by silver.moon
Fri Oct 02, 2015 9:26 am
Forum: C++ Development
Topic: Should you call Wait on a wxThreadHelper joinable thread that has stopped
Replies: 8
Views: 1947

Re: Should you call Wait on a wxThreadHelper joinable thread that has stopped

If you call the Wait() function for a thread that has already finished it will cause problems The why does the docs say (http://docs.wxwidgets.org/trunk/classwx_thread.html) Regardless of whether it has terminated or not, you should call Wait() on a joinable thread to release its memory, as outline...
by silver.moon
Fri Oct 02, 2015 9:14 am
Forum: C++ Development
Topic: How to construct wxImage from jpg image data
Replies: 1
Views: 486

How to construct wxImage from jpg image data

I have url of an image
I download it using Curl

I have the data in a char * and a std::string

Now how to construct a wxImage using that data ?
I want to avoid saving it to a file.
by silver.moon
Wed Sep 30, 2015 2:04 am
Forum: C++ Development
Topic: What happens if CreateThread is called again and again in wxThreadHelper
Replies: 9
Views: 1365

Re: What happens if CreateThread is called again and again in wxThreadHelper

wxThread::Wait frees the resources of a joinable thread.

But what about the wxThread object that the wxThreadHelper class is holding.
When I call CreateThread again, what happens to the previous wxThread object ?
by silver.moon
Wed Sep 30, 2015 1:55 am
Forum: C++ Development
Topic: Should you call Wait on a wxThreadHelper joinable thread that has stopped
Replies: 8
Views: 1947

Re: Should you call Wait on a wxThreadHelper joinable thread that has stopped

evstevemd wrote:Any reasona you are not using Detached Threads?
Never thought about it. What are the pros and cons ?
There are situations when i need to manually stop threads, how would I do that with a Detached thread ?
by silver.moon
Tue Sep 29, 2015 12:59 pm
Forum: C++ Development
Topic: Should you call Wait on a wxThreadHelper joinable thread that has stopped
Replies: 8
Views: 1947

Should you call Wait on a wxThreadHelper joinable thread that has stopped

Is it wrong to called Wait on joinable thread inside wxThreadHelper that has ended. GetThread()->Wait(); Doing so give this nice error dialog http://s3.postimg.org/3lzftrtub/wait_on_stopped_thread.png But the docs of wxThread say - Regardless of whether it has terminated or not, you should call Wait...
by silver.moon
Tue Sep 29, 2015 12:50 pm
Forum: C++ Development
Topic: What happens if CreateThread is called again and again in wxThreadHelper
Replies: 9
Views: 1365

What happens if CreateThread is called again and again in wxThreadHelper

This is from the wxThreadHelper docs void MyFrame::DoStartALongTask() { if (CreateThread(wxTHREAD_JOINABLE) != wxTHREAD_NO_ERROR) { wxLogError("Could not create the worker thread!"); return; } if (GetThread()->Run() != wxTHREAD_NO_ERROR) { wxLogError("Could not run the worker thread!"); return; } } ...