Search found 31 matches

by Giles
Sun Mar 08, 2009 3:40 pm
Forum: C++ Development
Topic: New to the crew, Virtual ListControl blues.
Replies: 7
Views: 1879

Thanks guys, we're getting there. Now, when I compile, I get two errors: undefined reference to `VirtualListCtrl::GetEventTable() const' undefined reference to `VirtualListCtrl::GetEventHashTable() const' Are you sure you get this error at compile time? I suppose this is returned by the linker. And...
by Giles
Sun Mar 08, 2009 1:19 pm
Forum: C++ Development
Topic: byte to bits
Replies: 7
Views: 1516

You are partially right. I know some older compilers do not support templates. But if look at the code, and you know a bit about templates, you see that the recursion is executed at compiletime, not at runntime! Its obvious, that this function is more efficient. Among the compilers that supported t...
by Giles
Sun Mar 08, 2009 10:42 am
Forum: C++ Development
Topic: byte to bits
Replies: 7
Views: 1516

Here is my way to compute this, its a bit more efficient :-): It will really depend on the optimizer. For each array item you get a (almost) recursive call (which is not efficient at all) unless the optimizer is able to inline such a complex template construction. But it may even not compile with s...
by Giles
Sun Mar 08, 2009 10:20 am
Forum: C++ Development
Topic: change the color of the scrollbars and picture distance
Replies: 2
Views: 896

You can change the scrollbar color (thumb and buttons excluded) by creating a separated wxScrollBar object and using SetBackgroundColour on this object. But if the scrollbar is part of a scrollable object I don't know a way to change its colour.
by Giles
Sat Mar 07, 2009 11:49 pm
Forum: C++ Development
Topic: New to the crew, Virtual ListControl blues.
Replies: 7
Views: 1879

The error you got means that at least one of the virtual functions redefined by your VirtualListCtrl class is not found by the linker. So check that all the methods declared in VirtualListCtrl are correctly defined, and that the file(s) where they are defined are included in the link command. Edited...
by Giles
Sat Mar 07, 2009 8:02 pm
Forum: C++ Development
Topic: New to the crew, Virtual ListControl blues.
Replies: 7
Views: 1879

It seems that you are trying to implement your list following the sample but using wxSmith. Unfortunately using wxSmith brings you constraints in your design that does not allow you to write any code you want. So I am not sure you will be able to code the sample the exact way you want. Though your p...
by Giles
Sat Mar 07, 2009 5:26 pm
Forum: C++ Development
Topic: byte to bits
Replies: 7
Views: 1516

Re: byte to bits

Just little shorter way to do the same... int MyProjectFrame::Byte2Bits(int number){ int *bits = new int[8]; for (int i = 7; i >= 0; --i) { bits[i] = number & 1; number >>= 1; } return bits; } Or int MyProjectFrame::Byte2Bits(int number){ int *bits = new int[8]; for (int *CurBit = bits + 8; CurB...
by Giles
Sat Mar 07, 2009 4:47 pm
Forum: C++ Development
Topic: How to call attached and detached threads
Replies: 2
Views: 863

You have to pass this information in the constructor. The manual will really help you if you really read it completely...

For the second question the heap is the memory area where the objects created by the C++ operator new are allocated (by default).
by Giles
Sat Mar 07, 2009 11:08 am
Forum: C++ Development
Topic: Cannot resume thread, handle is invalid?
Replies: 2
Views: 1787

Check the manual: a wxThread must be contructed, created and then run. You have constructed yours in the static function you have called Create. Correct though the function name may be confusing because it exists the function Create that is member of the wxThread base class. Then you try to run the ...
by Giles
Fri Mar 06, 2009 10:37 pm
Forum: C++ Development
Topic: Why cant I access my thread?
Replies: 7
Views: 2335

I provided you with the 2 examples above that show how to proceed without the pointer class depending on what you want to do.

PS: Note that your question is a C++ beginner problem only and has no much thing in common with wxWidget questions which this forum is dedicated to...
by Giles
Fri Mar 06, 2009 10:27 pm
Forum: C++ Development
Topic: Wait until a wxFrame has been destroyed
Replies: 3
Views: 2148

I realize that your code misses the

Code: Select all

oMyFrame->Destroy();
So you will get memory leaks. Warning: you must NOT use delete oMyFrame; in the onClose

When destroying the frame, wxWidgets should correctly perform the event disconnection I think. So try to replace the disconnect with the Destroy.
by Giles
Fri Mar 06, 2009 9:21 pm
Forum: C++ Development
Topic: Why cant I access my thread?
Replies: 7
Views: 2335

It is not clear if your thread is a singleton created by one of the 3 classes or if there can be several threads one per bar instance created. If you want a singleton, declare the pointer as a static pointer variable in fooThread class If you want as many threads as bar class instances, you have to ...
by Giles
Fri Mar 06, 2009 8:06 pm
Forum: C++ Development
Topic: Wait until a wxFrame has been destroyed
Replies: 3
Views: 2148

You don't need a loop as you can receive a close event for the dialog form void frmMyForm::onClose(wxCloseEvent& event) { //-- Activate again the background task } To connect the procedure to the window event: oMyForm.Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&frmMyForm::onC...
by Giles
Wed Mar 04, 2009 11:18 pm
Forum: C++ Development
Topic: Button Shape
Replies: 6
Views: 3266

What do you mean by "does not respond to events"? Which events, which response did you expect? If by events you mean mouse events and the reaction is the change of appearance of the button, if you provide several bitmaps, one that represents how the button must look like in normal state an...
by Giles
Tue Mar 03, 2009 7:27 pm
Forum: C++ Development
Topic: Button Shape
Replies: 6
Views: 3266

I am using the wxBitmapButton and I'd never set wxNO_BORDER and I have no border drawn :?: But you MUST avoid setting wxBU_AUTODRAW (which is the default value). This flag generates a 3D rectangular border that changes when the button is pressed. To summarize: with style=0 my button looks exactly li...