Hi John,

The sample is very simple. You create any frame with a text widgets on it, Enable wxTE_RICH and wxTE_RICH2 as well.  Add some code to display the getvalue of the text widget and display it using wx.wxMessageBox for example. You will get null (nothing displayed)

The unicode sample you can get from this site  http://vnexpress.net/    just copy some text there and paste.

--  Sample code
f=wx.wxFrame(wx.wxNull, -1, "")
s0=wx.wxBoxSizer(wx.wxVERTICAL)
f:SetSizer(s0)
idtext=wx.wxID_HIGHEST+1
text=wx.wxTextCtrl(f, idtext,  "",  wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxTE_MULTILINE+wx.wxTE_RICH+wx.wxTE_RICH2)
b0=wx.wxButton(f, 10000, "Display")
s0:AddWindow(text)
s0:AddWindow(b0)
f:Connect(-1, wx.wxEVT_COMMAND_BUTTON_CLICKED, function (e)
wx.wxMessageBox(text:GetValue() )
end)
f:Show(true)
-- end sample code

The problem only happened in win32 (all window version). Linux GTK is fine which make me think it is a bug in the wxWidget conversion code in win32. Actually I did not find errors in the old code, but in wxWidgets we just have too many ways of doing such conversions and the old wxLua code is not the same as the code I usually using in my apps which proves to work fine (I have had lots of strange problem in these conversion things until I found a reliable way of doing such conversion) So I replace it with my code and it works as expected.


John Labenski <[EMAIL PROTECTED]
<[EMAIL PROTECTED]>
Where did you get the Unicode string that doesn't work in your sample
program? Could you post one? I tried different things in wxGTK
compiled in Unicode, but I had no problem with the original conversion

Yeah as I said, only happen in win32.<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
Do we also need to care about embedded NULLS? There is a lua function
to get the string as well as it's length, maybe we should use that
too? Perhaps the unicode string had embedded NULLs?
The sample in the website I said before is Vietnamese text ; coding using standard UTF-8, not quite sure if it contain NULL but I guess not. <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>> #if wxUSE_UNICODE
> return wxString(luastr, wxConvUTF8);
The above part is tested as I use the unicode built of wxWidgets<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>> #else
> return wxString(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent);
Always wxConvUTF8 in Unicode? Not wxConvCurrent?
Have not tested in non Unicode built of wxWidgets. but in this case I gues it will use  wxMBConv.cMB2WC  or wxConvLibc.cMB2WC. So this part should change accordingly (it may even work without changes but let me test in non unicode built first)
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>I don't understand why in non unicode you convert it to a WC array and
then back. You should be able to just to "return wxString(luastr)"
since everything is ASCII.
Even wxWidgets is built without unicode support but the string we get it  might contain unicode chars so it is not pure ASCII.
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]><[EMAIL PROTECTED]>Cheers,



S.KIEU


On Yahoo!7
Messenger: Make free PC-to-PC calls to your friends overseas.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to