Search found 61 matches

by softport
Wed Jan 09, 2013 7:42 am
Forum: wxDev-C++
Topic: wxDev-C++7.4 sometime not save the changes of the project
Replies: 1
Views: 2349

Re: wxDev-C++7.4 sometime not save the changes of the projec

I've had the same problem, but can't say why it happens. My solution, till a better one is suggested, is to have a file that shows exactly how your project tree should look like. This will make it easier to fix. Sometimes the names of some files and folders will get mixed up, and you end up with a n...
by softport
Sun Jan 06, 2013 12:55 pm
Forum: wxDev-C++
Topic: Advice for implementing start/stop of free running process?
Replies: 11
Views: 7846

Re: Advice for implementing start/stop of free running proce

That looks a lot cleaner than what I ended up with, so I'll study it and implement it if I can. This is how I got it to work: In "class ThreadsFrm : public wxFrame" : made a private variable: wxThread* t; made public function: void setT(wxThread* myThreadPointer); In ThreadsFrm.cpp: void ThreadsFrm:...
by softport
Sun Jan 06, 2013 12:05 pm
Forum: wxDev-C++
Topic: Advice for implementing start/stop of free running process?
Replies: 11
Views: 7846

Re: Advice for implementing start/stop of free running proce

Thanks doublemax, I was thinking about that and wondering if it would result in the thread being created (using up memory), before it's needed. But I could just move the MyThread* t = new MyThread(this) out into Frm,
and keep wxThreadError err = t->Create(); in the button event routine?
by softport
Sun Jan 06, 2013 11:44 am
Forum: wxDev-C++
Topic: Advice for implementing start/stop of free running process?
Replies: 11
Views: 7846

Re: Advice for implementing start/stop of free running proce

Hi again, today I made my first (test) program that creates a thread. It's function: 1. Press front panel button to start the thread. 2. On entry the thread sends back an event, signalling that it has started 3. Main program sets a flag "Thread running". 4. If you press the button again, and "Thread...
by softport
Sat Jan 05, 2013 1:48 pm
Forum: General Development
Topic: A useful compiler warning: Single '=' in if statement
Replies: 2
Views: 3155

Re: A useful compiler warning: Single '=' in if statement

Thanks doublemax, that worked: (Thanks for the link too)

Code: Select all

void Project1Frm::WxButton1Click(wxCommandEvent& event)
{
    int a, b;
    
    if(a = b){}
}
MingW compiler warning:
74:13 C:\...\Project1Frm.cpp [Warning] suggest parentheses around assignment used as truth value [-Wparentheses]
by softport
Sat Jan 05, 2013 3:13 am
Forum: General Development
Topic: A useful compiler warning: Single '=' in if statement
Replies: 2
Views: 3155

A useful compiler warning: Single '=' in if statement

Today I spent a few hours debugging a program. The problem was that I had a single '=' in an if statement condition, instead of '=='. It would be great if the compiler issued a warning in this case, maybe as an option that idiots could turn on :P Is it ever useful to have a single equals sign in an ...
by softport
Thu Jan 03, 2013 12:10 pm
Forum: C++ Development
Topic: Unable to left shift 'unsigned long' by 16
Replies: 2
Views: 1029

Re: Unable to left shift 'unsigned long' by 16

Thanks Radek, it was the 'h' in my format statement, removed it and now it prints the full number. I can't remember where I picked that up from.
by softport
Thu Jan 03, 2013 3:25 am
Forum: C++ Development
Topic: Unable to left shift 'unsigned long' by 16
Replies: 2
Views: 1029

Unable to left shift 'unsigned long' by 16

Hello, I've been battling with this for a couple of hours now. I have an 'unsigned long' variable that needs to be left shifted by 16, but the answer comes out to 0 every time. unsigned long ulTemp; unsigned char ucTemp, ucSIDH; . . . ulTemp = (unsigned long)(ucTemp + ucSIDH); ulTemp = ulTemp << 16;...
by softport
Thu Dec 27, 2012 10:29 pm
Forum: wxDev-C++
Topic: Accuracy of wxStopWatch?
Replies: 5
Views: 4031

Re: Accuracy of wxStopWatch?

Thanks Tony, my application doesn't need super precise, or real time, interval measurement. Currently I am just sending a packet out of the USB port, then in a loop: usleep(3ms), check for a response from the external device. In the earlier post, just using usleep in the test program, I could get an...
by softport
Sun Dec 23, 2012 8:08 pm
Forum: wxDev-C++
Topic: Advice for implementing start/stop of free running process?
Replies: 11
Views: 7846

Re: Advice for implementing start/stop of free running proce

Last night I started reading about how to set up threads. That would be best, so it's time to put this button thing aside for now, and move on to do what needs to be done. Then worry about the darn button and threads.

thanks doublemax, and Tony.

Walter
by softport
Sun Dec 23, 2012 7:53 pm
Forum: wxDev-C++
Topic: Advice for implementing start/stop of free running process?
Replies: 11
Views: 7846

Re: Advice for implementing start/stop of free running proce

Thanks doublemax, now those instructions are not causing a compiler error anymore. I'm having the same trouble with wxApp::FilterEvent, but I think it's a matter of where this function can run (not in an event servicing routine?). I found this example on how to use Filter Event , and am about to try...
by softport
Sun Dec 23, 2012 6:12 am
Forum: wxDev-C++
Topic: Advice for implementing start/stop of free running process?
Replies: 11
Views: 7846

Re: Advice for implementing start/stop of free running proce

Thanks Tony, I've been experimenting all this time (since my last post!). I also found another function I wanted to try, wxApp.Pending . I'm doing something wrong when calling any function of the form wxApp. I assumed that wxApp is the name of my application : class PicCanBrdFrmApp : public wxApp { ...
by softport
Sat Dec 22, 2012 4:15 pm
Forum: wxDev-C++
Topic: Advice for implementing start/stop of free running process?
Replies: 11
Views: 7846

Advice for implementing start/stop of free running process?

Hi, I couldn't get the subject description very precise. Here's what I need to do: When I press a wxButton, the event starts code to continuously monitor a CAN bus (or say any process). However, I would like to stop the monitoring code when the same wxButton is pressed again. I assume that once the ...
by softport
Fri Dec 21, 2012 4:37 am
Forum: wxDev-C++
Topic: Accuracy of wxStopWatch?
Replies: 5
Views: 4031

Re: Accuracy of wxStopWatch?

Thanks doublemax, I'll follow that lead for some more info. I guess usleep() must use the same API.
by softport
Fri Dec 21, 2012 2:21 am
Forum: wxDev-C++
Topic: Accuracy of wxStopWatch?
Replies: 5
Views: 4031

Accuracy of wxStopWatch?

Hi, today I was looking for a way of generating pauses with an accuracy of a few ms. I wrote a small program to compare the performance of wxTimer and usleep(). I passed each function the same ms value, then used wxStopWatch to measure the time intervals. Here's a shot of the front panel: http://i45...