From: Steve K. <ha...@ya...> - 2006-05-30 01:12:04
|
Hi, I have a minimum simple script to show as below: frame=wx.wxFrame(wx.wxNull, 10001, "test") --frame:ConnectEvent(10001, wx.wxEVT_ENTER_WINDOW, function (event) print"Enter work" end) --frame:ConnectEvent(10001, wx.wxEVT_LEAVE_WINDOW, function (event) print"Leave not work" end) --not work --frame:ConnectEvent(10001, wx.wxEVT_MOTION, function (event) print"Motion Work" end) --frame:ConnectEvent(10001, wxEVT_LEFT_DCLICK, function (event) print"Not work" end) --frame:ConnectEvent(10001, wxEVT_LEFT_DOWN, function (event) print"Left down not work" end) --frame:ConnectEvent(10001, wxEVT_LEFT_UP ,function (event) print"Left up not work" end) --frame:ConnectEvent(10001, wxEVT_RIGHT_DCLICK ,function (event) print"Right dclick not work" end) --frame:ConnectEvent(-1, wxEVT_RIGHT_DOWN ,function (event) print"Right down not work" end) --frame:ConnectEvent(-1, wxEVT_RIGHT_UP ,function (event) print"Right up not work" end) frame:Center() frame:Show(true) Pls note that the above script, the equivalent C++ work as expected. I have tested it using Dialogblocks; add one frame and add the event accordingly. This one is not related to html window at all And the HTML window; as you suspect from the above one; it work with wxEVT_COMMAND_BUTTON_CLICKED but not with wxEVT_BUTTON_CLICK or wxEVT_LEFT_DCLICK. I have not tested it with another kind of event. frame = nil html = nil htmlTextPage = [[<html> <head> <title>Not working</title> </head> <body> <h3>wxHtmlWidgetCell demonstration</h3> There are three bound widgets below. <hr> <center> <lua text="first widget" x=100 y=70> </center> </body> </html>]] function main() -- create the frame window frame = wx.wxFrame( wx.wxNull, wx.wxID_ANY, "HtmlWindow Demo", wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE ) -- create a simple file menu -- THIS WORKS -- frame:ConnectEvent(30000, wx.wxEVT_COMMAND_BUTTON_CLICKED, function(event) -- wx.wxMessageBox("Clicked me") end -- -- ) --THIS NOT WORK frame:ConnectEvent(30000, wx.wxEVT_LEFT_DCLICK, function(event) wx.wxMessageBox("Clicked me") end ) -- create the html window html = wx.wxLuaHtmlWindow(frame, 15000) html.OnSetTitle = function(self, title) frame.Title = frame.Title.." - "..title end -- when a lua custom tag is parsed in the html, this event handler -- will be invoked wx.wxGetBaseApp():ConnectEvent(wx.wxID_ANY, wx.wxEVT_HTML_TAG_HANDLER, function (event) CreateBoundWindow(event) end) -- set the frame window and status bar html:SetRelatedFrame(frame, "wxHtmlWindow wxLua Sample : %s") html:SetRelatedStatusBar(1) -- load the document html:SetPage(htmlTextPage) -- html:LoadPage("testpage.html") -- show the frame window wx.wxGetBaseApp().TopWindow = frame frame:Show(true) end function CreateBoundWindow(event) local ax, ay local rc, fl = 0 -- parse the X parameter in the custom lua tag rc, ax = event.HtmlTag:GetParamAsInt("X") -- parse the Y parameter rc, ay = event.HtmlTag:GetParamAsInt("Y") -- if there is a float tag set the float if event.HtmlTag:HasParam("FLOAT") then fl = ax end -- create the control to embed local parent = event.HtmlParser.Window if parent then -- local wnd = wx.wxTextCtrl( parent, -- wx.wxID_ANY, -- event.HtmlTag:GetParam("TEXT"), -- wx.wxPoint(0, 0), -- wx.wxSize(ax, ay), -- wx.wxTE_MULTILINE ) -- -- show the control local wnd = wx.wxButton( parent, 30000, event.HtmlTag:GetParam("TEXT"), wx.wxPoint(0, 0), wx.wxSize(ax, ay) ) -- show the control wnd:Show(true) -- create the container widget cell local widget = wx.wxHtmlWidgetCell(wnd, fl) -- insert the cell into the document event.HtmlParser:OpenContainer():InsertCell(widget) event:SetParseInnerCalled(false) end end main() Can you post a little bit of code to show how it should work and what I should expect to see based on your C++ tests. I have never used the HTML widget in lua or C++. Sorry the code is a bit too long :-) Cheers, S.KIEU --------------------------------- On Yahoo!7 Answers: Real people ask and answer questions on any topic. |