Search found 9 matches

by closer
Fri Oct 02, 2009 8:30 am
Forum: wxWidgets Development (Chinese)
Topic: 使用2.9版後,wxRichTextCtrl 的中文內容都變成亂
Replies: 9
Views: 5150

HeMason wrote:這問題還是沒解!

因為我可能讀進不同編碼的檔案,是否要自己偵測,然後降內容轉碼成UTF-8後,再交給 wxRichTextCtrl?
對,「自動偵測」這件事可能還是得要自己來。
當然也可以讓使用者自己選擇。
我想到的是可以提供一個預覽視窗,讓使用者看「這樣的解碼結果是否合理」。

另外,若您的使用者一般只開與自己的作業系統語系相同的檔案,
(例如繁中 Windows 使用者只開 big5;簡中使用者只開 GB)
那也許可以考慮使用 wxFONTENCODING_SYSTEM,讓作業系統決定。
by closer
Wed Sep 23, 2009 6:26 am
Forum: wxWidgets Development (Chinese)
Topic: 使用2.9版後,wxRichTextCtrl 的中文內容都變成亂
Replies: 9
Views: 5150

Re: 使用2.9版後,wxRichTextCtrl 的中文內容都變

原先我以為 wxWidgets 或 wxRichTextCtrl 有什麼設定可以直接改變預設的檔案/字串編碼。恐怕這算盤要落空了。 您是使用 wxRichTextCtrl::LoadFile() 嗎? 我手上的程式只用了 wxTextCtrl。 我剛剛 trace 了一下 wxTextCtrl::LoadFile(),發現它使用 wxConvAuto() 轉換檔案的字碼。 因此,若是依下的方法做的話,是可以改變預設的檔案編碼的! wxFontEncoding old_encoding = wxConvAuto::GetFallbackEncoding(); wxConvAuto::SetFa...
by closer
Tue Sep 22, 2009 4:28 am
Forum: wxWidgets Development (Chinese)
Topic: 使用2.9版後,wxRichTextCtrl 的中文內容都變成亂
Replies: 9
Views: 5150

Re: 使用2.9版後,wxRichTextCtrl 的中文內容都變

HeMason wrote:
sishui wrote: 将你的中文 to unicode 再显示在wxRichTextCtrl中试试
願聞其詳!
我的程式中是用下面的方法將 Big5 的中文轉成 Unicode 的:

Code: Select all

wxCSConv convBig5(wxFONTENCODING_BIG5);

char* big5_string = get_string_from_somewhere();
wxString unicode_string = wxString( big5_string, convBig5);
您可以參考一下。
by closer
Thu May 21, 2009 9:11 am
Forum: wxWidgets Development (Chinese)
Topic: =自我介绍=(新人可来这里对自己作自我介绍)
Replies: 150
Views: 379806

小弟在台灣,工作是嵌入式系統的軔體維護研發。
wxWidgets 算是個人興趣吧!偶爾也會拿它來開發工作用的小程式。

知道 wxWidgets 已經很長一段時間了;但真的認真拿來用、研究其中的一些技巧,也只是這一兩年的事。

去年開了個 blog,希望能記錄一些使用 wxWidgets 的心得。
不過本身的工作很忙,再加上家庭也需要照顧,
開了大半年也只有 4 篇文章。(汗)

可能不會太常來這兒逛,不過還是請大家多多指教。
by closer
Mon Mar 16, 2009 10:14 am
Forum: Platform Related Issues
Topic: How to find text within a multi-line rich edit wxTextCtrl?
Replies: 12
Views: 6468

closer: I use multi-line text searching in QuRegExmm. Check out the source code on sourceforge. protocol, I downloaded QuRegExmm and looked into the sources. I found that you used wxRegEx in QuRegExmm, so I tried the similar way in my code. Unfortunately, the result is still the same. However, when...
by closer
Tue Mar 10, 2009 5:24 am
Forum: Platform Related Issues
Topic: How to find text within a multi-line rich edit wxTextCtrl?
Replies: 12
Views: 6468

Hi all, I'm trying to do similar function (search in multiline wxTextCtrl) recently, and I encountered the "\n" vs "\r\n" problem. Though I have a solution, but I don't think it's a perfect one. Now I'll list what I have known, and if you have any good ideas, please kindly share ...
by closer
Fri Feb 06, 2009 8:43 am
Forum: C++ Development
Topic: RTTI, dynamic casting, wxClientData questions
Replies: 6
Views: 2079

Well, I found that too after posting the previous post. :) I was stuck with the idea that "use wxWidgets' RTTI functions only". I did some tests in VC++ 2008 Express and listed some points worth to be noticed: 1. If dynamic_cast's are used, the "RTTI support" option of the compil...
by closer
Fri Feb 06, 2009 5:35 am
Forum: C++ Development
Topic: RTTI, dynamic casting, wxClientData questions
Replies: 6
Views: 2079

Ah, I was wrong.
I misunderstood the content of the documents and thought that wxClienData is derived from wxEvtHandler.

I apologize for my misleading information.

And since that doesn't work, the multiple inheritance is also the only way I can think of so far....
by closer
Thu Feb 05, 2009 11:27 am
Forum: C++ Development
Topic: RTTI, dynamic casting, wxClientData questions
Replies: 6
Views: 2079

Disch, I'm not quite familiar with RTTI either, but I don't think you have to derive your class from wxObject. (wxClientData is already derived from wxObject) You should try this: // header file class SourceInfo : public wxClientData { public: DECLARE_DYNAMIC_CLASS(SourceInfo) // .. vars and junk he...