Search found 99 matches

by Disch
Thu Feb 12, 2009 6:34 pm
Forum: C++ Development
Topic: Creating a button during runtime
Replies: 3
Views: 454

Nothing is standing out to me as being obviously wrong... unless... You're creating testButton with 'this' as a parent (where 'this' is of type 'myFrame') -- is that the right parent? The dialog should be the parent. Or is myFrame the dialog (in which case that's a somewhat misleading name :wink: )....
by Disch
Thu Feb 12, 2009 6:03 pm
Forum: C++ Development
Topic: Detecting clicks outside of Modal Window
Replies: 8
Views: 615

This kind of defeats the point of using a modal dialog. The whole idea is that the user cannot interact with any other part of the program until the modal dialog is dealt with.

Perhaps you should use a modeless dialog instead. Is there any reason why this needs to be a modal dialog?
by Disch
Thu Feb 12, 2009 4:15 pm
Forum: C++ Development
Topic: Return mouse coords. relative to window
Replies: 2
Views: 859

Re: Return mouse coords. relative to window

I hope this isnt too confusing, I've tried the ScreenToClient() function and havn't quite understood how I'm going to return the CORRECT position ScreenToClient is what you want. Just run the mouse's screen coords through it: wxPoint MyWindow::MousePosInWindow() { return ScreenToClient(::wxGetMouse...
by Disch
Thu Feb 12, 2009 4:03 pm
Forum: C++ Development
Topic: Load from file in unicode
Replies: 7
Views: 1053

But if in the file I have only 1 byte for character and it writes 4 bytes for the word "test", it will lose information and I can't have a portable file for several languages. This is a little funky to explain if you're not already familiar with it. UTF-8 characters are variable size. This means th...
by Disch
Thu Feb 12, 2009 2:34 am
Forum: C++ Development
Topic: How to stop wxTextCtrl from auto scrolling to bottom
Replies: 3
Views: 954

Code: Select all

// make the top of the text box visible
myTextCtrl->ShowPosition(0);

// you may also want/need to move the carat to the top of the
//   box with this:
myTextCtrl->SetSelection(0,0);
by Disch
Wed Feb 11, 2009 9:13 pm
Forum: C++ Development
Topic: Load from file in unicode
Replies: 7
Views: 1053

Maybe wxMBConvFile would help in this case...? wxMBConvFile is for converting to whatever format the platform recognizes for file names (ie, it's what you would pass to wxFile::Open). It wouldn't really help in this case because he's writing his string as UTF-8 to the file. For a more detailed expl...
by Disch
Wed Feb 11, 2009 7:20 pm
Forum: C++ Development
Topic: Load from file in unicode
Replies: 7
Views: 1053

Re: Load from file in unicode

The line: e = _stream.Read (&str [0], len); gets the wrong text. What am I doing wrong? You should refrain from writing to the buffer directly, because the characters in wxString will be stored differently depending on the Unicode build settings (ie: each character might be 1 or 2 bytes -- as oppos...
by Disch
Wed Feb 11, 2009 6:00 pm
Forum: C++ Development
Topic: the wxPanels color changes only when the window is minimized
Replies: 2
Views: 488

Try calling Panel1->Refresh(); after you change the background color.
by Disch
Wed Feb 11, 2009 4:19 am
Forum: Compiler / Linking / IDE Related
Topic: where is the "wxmsw28d_core.lib"
Replies: 3
Views: 1237

Assuming you're using MSVS, wxmsw28d_core.lib should be in 'wxWidgets-2.8.9/lib/vc_lib/' after you build the debug version of wxWidgets. All the libs you mentioned are different builds of the wx core library. They should all be in the same directory assuming you built all of them: wxmsw28_core.lib -...
by Disch
Tue Feb 10, 2009 9:02 pm
Forum: C++ Development
Topic: wxString::wc_str() when not in Unicode build
Replies: 3
Views: 764

this creates a pointer to a temporary object that is already invalid at the next line I see! Thanks! Your solution works, but I'm a bit confused as to how that behavior is even possible. Wouldn't any temporary object be destroyed when its scope is lost (which would be as soon as wc_str exits)? How ...
by Disch
Tue Feb 10, 2009 8:22 pm
Forum: C++ Development
Topic: wxString::wc_str() when not in Unicode build
Replies: 3
Views: 764

wxString::wc_str() when not in Unicode build

I'm having a bit of trouble using wxString wc_str when not working with Unicode. Here's a quick sample program I made: #include <wx/wx.h> class MyApp : public wxApp { bool OnInit() { wxASSERT(sizeof(wxChar) == 1); wxASSERT(sizeof(wchar_t) == 2); wxString str = wxT("j"); const wchar_t* buf = str.wc_s...
by Disch
Tue Feb 10, 2009 8:13 pm
Forum: C++ Development
Topic: Where is EVT_TEXT_ENTER?
Replies: 2
Views: 1732

Re: Where is EVT_TEXT_ENTER?

Connect(EVT_TEXT_ENTER, wxCommandEventHandler(TextEntry::Done)); Unless I'm mistaken... EVT_TEXT_ENTER is the event table macro, not the event ID. You probably want wxEVT_COMMAND_TEXT_ENTER here instead. TextEntry::~TextEntry(void){ if (textctrl) delete textctrl; } Do not delete child controls or c...
by Disch
Tue Feb 10, 2009 6:56 pm
Forum: C++ Development
Topic: wxFileDialog was not declared in this scope error
Replies: 3
Views: 952

are you including <wx/filedlg.h> with all of your other #includes?
by Disch
Mon Feb 09, 2009 10:12 pm
Forum: C++ Development
Topic: Hiding dialogs w/ inactive main window
Replies: 6
Views: 546

Can you just call Update() after hiding the window? This supposedly would force redrawing of the window immediately (and would thus hide it immediately). Not sure if that would work though -- but it's worth a try.
by Disch
Mon Feb 09, 2009 8:51 pm
Forum: C++ Development
Topic: Event capture during for loop
Replies: 5
Views: 1064

I meant x*y, because Array[x*y + x] turns the single dimensional array into a psuedo two dimensional one Not really, because x is a counter, not a constant value. The typical way to do this kind of indexing is (y*width)+x. (y*x)+x will give you very wacky results. Think about it for a bit... if you...