Search found 286 matches

by Radek
Wed Jan 16, 2013 4:34 pm
Forum: C++ Development
Topic: Is my frame flagged for destruction?
Replies: 14
Views: 3313

Re: Is my frame flagged for destruction?

All depends on the parent-child relations. Never destroy children. Children gets destroyed automatically when the parent gets destroyed. It's the same relation like in the "normal" window programming: you destroy the window but you don't care destroying buttons or entryfields on it. Also, the top le...
by Radek
Wed Jan 16, 2013 5:04 am
Forum: C++ Development
Topic: Image load save issues
Replies: 9
Views: 2201

Re: Image load save issues

If there are many reasons then you need to program the logic yourself. wxWidgets has no defaults here. Check the file name and extension, check whether the file exists, try LoadFile() and when it fails (this is bad format now), check whether you have already reported such failure, report error, deci...
by Radek
Mon Jan 07, 2013 2:58 pm
Forum: C++ Development
Topic: Draw TTF font on OpenglCanvas
Replies: 3
Views: 1940

Re: Draw TTF font on OpenglCanvas

If you are talking about wxGLCanvas then there are several possibilities: (1) X-fonts: void MyCanvas::InitGL() { Display *dpy = glXGetCurrentDisplay(); // Display is XFontStruct xFont = XLoadQueryFont(dpy,"-*-courier-medium-r-normal--24-*-*-*-*-*-*-*"); IDStart = glGenLists(96); glClearColor(0.0,0.0...
by Radek
Thu Jan 03, 2013 9:30 am
Forum: C++ Development
Topic: Unable to left shift 'unsigned long' by 16
Replies: 2
Views: 1196

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

The problem is elsewhere. I've just run in a debugger: int MyApp::OnRun() { wxString str; str.Printf(wxT("%08X"),0xFFFFFFFF); return 0; } and I've got what I've expected: "FFFFFFFF". Suspected locations: (1) Missing wxT() in the format specification. In code page based operating systems where char i...
by Radek
Wed Jan 02, 2013 8:23 am
Forum: C++ Development
Topic: Show wxDialog when wxFrame is visible
Replies: 3
Views: 1256

Re: Show wxDialog when wxFrame is visible

What do you want exactly? When the app starts, show the frame and, immediately, show the dialog, too? If it is so, then I would try the idle event. You should get the idle event once the frame appears on the screen. Therefore: (1) In the frame ctor, create the dialog but do not Show() it. The frame ...
by Radek
Sun Dec 30, 2012 8:19 am
Forum: C++ Development
Topic: dynamically scaling font size with wxTextCtrl
Replies: 4
Views: 2534

Re: dynamically scaling font size with wxTextCtrl

A bit complicated task. AFAIK, the only object capable of GetTextExtent() is a wxDC. Therefore:

(1) Get client DC of the wxTextCtrl using wxClientDC(the_TextCtrl);
(2) Get current font size.
(3) Get the TextCtrl size.
(4) Call GetTextExtent(the_text);
(5) Calculate the needed font size.
by Radek
Sun Dec 30, 2012 5:02 am
Forum: C++ Development
Topic: Set event in a function
Replies: 2
Views: 660

Re: Set event in a function

Yes, the principal question: do you really need 1000 timers? IMO, in most situations, you need to implement only one timer which works like a scheduler. It maintains a schedule list and calls clients when the time comes. Every client (there can be even more than 1000 clients) puts an item on the sch...
by Radek
Thu Dec 20, 2012 4:00 pm
Forum: C++ Development
Topic: Modeless Dialog
Replies: 6
Views: 4116

Re: Modeless Dialog

This should not even compile, over9k. The newAddDialog needs to be a pointer to AddDialog, not an instance. Subsequently the if needs to be: if (newAddDialog->ShowModal() == wxID_OK) { //do something } The ShowModal() returns an ID, so that you can test to wxID_OK, on the other hand, Show() returns ...
by Radek
Thu Dec 20, 2012 6:23 am
Forum: C++ Development
Topic: help me to compile this....any settings needed for this ??
Replies: 11
Views: 2989

Re: help me to compile this....any settings needed for this

You cannot compile setup.h. You need to recompile wxWidgets with USE_OPENGL from sources. Or you need to get a precompiled package of wxWidgets which was compiled with USE_OPENGL. There should be such package compiled for windows and usable with VC somewhere around.
by Radek
Wed Dec 19, 2012 5:36 am
Forum: C++ Development
Topic: Unhandled Exception with windows and wxGLCanvas
Replies: 7
Views: 1842

Re: Unhandled Exception with windows and wxGLCanvas

Debug the window procedure and see which message causes the GP fault. In my experience (I am not using windows), you can make OpenGL calls from wxWidgets after you get your first OnPaint event. Otherwise, you get a GP fault. In the windows environment, the first message, which makes OpenGL calls sho...
by Radek
Sun Dec 16, 2012 4:46 pm
Forum: C++ Development
Topic: Calling C function from wxWidget Project (C++ project)
Replies: 6
Views: 2187

Re: Calling C function from wxWidget Project (C++ project)

A few remarks: Why you cannot rename your *.c files to *.cc or to *.cpp and use only a C++ compiler in the whole project? C is a subset to C++, almost everything in C is acceptable in C++. You will save many troubles by using only C++. You need to use a C compiler if: (1) You are calling the C code ...
by Radek
Fri Dec 14, 2012 5:54 pm
Forum: Platform Related Issues
Topic: GTK - Left Indent in wxRichTextCtrl?
Replies: 2
Views: 1014

Re: GTK - Left Indent in wxRichTextCtrl?

Yes, that's what I want.

Code: Select all

:ma 5.
Some indented text, bla bla bla ...
:ma.
Not indented text, and so on.
:ma 5. is (should be) parsed and applied. The following text is produced by WriteText() subsequently. :ma. without a parameter is the same as :ma 0.
by Radek
Fri Dec 14, 2012 5:12 pm
Forum: Platform Related Issues
Topic: GTK - Left Indent in wxRichTextCtrl?
Replies: 2
Views: 1014

GTK - Left Indent in wxRichTextCtrl?

I would like to implement a "left margin" command for my viewer. The command is ":ma indent-in-M-squares. ". End of indent is ":ma." I did something like this: int indent = 0; // current indent value (starting value = 0) ... switch( elem.type ) { case Parser::eMargin : { if( elem.offs > 0 ) // wante...
by Radek
Fri Dec 14, 2012 5:26 am
Forum: C++ Development
Topic: Calling C function from wxWidget Project (C++ project)
Replies: 6
Views: 2187

Re: Calling C function from wxWidget Project (C++ project)

extern "C" is a C++ directive not recognized by a C compiler. I guess your problem consists in sharing myTest.h header between C and C++ code. If you cannot avoid mixing C and C++ code (by using only C++ compiler), then: file myTest.h #ifdef __cplusplus extern "C" { #endif void cFunction(void); ......