1. wxEuphoria - wxHtmlWindow vs Vista

On Vista, how do you make a wxHtmlWindow in such a way that when you click on it
the widgets on the window under it don't come up? On Ubuntu there is no problem.

new topic     » topic index » view message » categorize

2. Re: wxEuphoria - wxHtmlWindow vs Vista

Jerry Story wrote:
> 
> On Vista, how do you make a wxHtmlWindow in such a way that when you click 
> on it the widgets on the window under it don't come up? On Ubuntu there is
> no problem.

I don't know.  Could you post a minimal sample that displays the behavior?
And a better description of the expected and observed results.  I'm not sure
what you mean by "the widgets on the window under it don't come up."

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: wxEuphoria - wxHtmlWindow vs Vista

Matt Lewis wrote:
> 
> Jerry Story wrote:
> > 
> > On Vista, how do you make a wxHtmlWindow in such a way that when you click 
> > on it the widgets on the window under it don't come up? On Ubuntu there is
> > no problem.
> 
> I don't know.  Could you post a minimal sample that displays the behavior?
> And a better description of the expected and observed results.  I'm not sure
> what you mean by "the widgets on the window under it don't come up."
> 
> Matt

Here are the relevant code fragments with comments added.

constant
 frmHtml = create(wxFrame,{Win,-1,"DMAK - documentation"}),
 pnlHtml = create(wxPanel,{frmHtml}),
 boxHtml = create(wxBoxSizer,{wxVERTICAL}),
 winHtml = create(wxHtmlWindow,{Win})

set_sizer(pnlHtml,boxHtml)
set_size(winHtml,win_width,win_height)
add_window_to_sizer(boxHtml,winHtml,1,wxGROW,0)

-- Win is the main wxPanel. It has a bunch of widgets on it.
-- winHtml is on top of Win, same dimensions and position.
-- Win is completely covered by winHtml.
-- So far winHtml looks good on both Ubuntu and Vista.

-- [.....]

procedure closeHtmlESC(atom this, atom event_type, atom id, atom event)
  -- code here
  -- closes winHtml on ESC, SPACE, or mouse click

end procedure
set_event_handler(winHtml,-1,wxEVT_CHAR, routine_id("closeHtmlESC"))
set_event_handler(winHtml,-1,wxEVT_LEFT_UP, routine_id("closeHtmlESC"))

-- Keys work correctly on both Vista and Ubuntu.
-- ESC and SPACE make winHtml go away, both Ubuntu and Vista.

-- Mouse click works correctly on Ubuntu but not on Vista.

-- On Vista, on mouse click, winHtml doesn't go away
-- and the Win widget or a part of it that is under the mouse click
-- becomes visible thru winHtml.
-- And the keys quit making winHtml go away.


new topic     » goto parent     » topic index » view message » categorize

4. Re: wxEuphoria - wxHtmlWindow vs Vista

Jerry Story wrote:
> 
> Matt Lewis wrote:
> > 
> > Jerry Story wrote:
> > > 
> > > On Vista, how do you make a wxHtmlWindow in such a way that when you click
> > >
> > > on it the widgets on the window under it don't come up? On Ubuntu there is
> > > no problem.
> > 
> > I don't know.  Could you post a minimal sample that displays the behavior?
> > And a better description of the expected and observed results.  I'm not sure
> > what you mean by "the widgets on the window under it don't come up."
> > 
> > Matt
> 
> Here are the relevant code fragments with comments added.
> 
> }}}
<eucode>
> constant
>  frmHtml = create(wxFrame,{Win,-1,"DMAK - documentation"}),
>  pnlHtml = create(wxPanel,{frmHtml}),
>  boxHtml = create(wxBoxSizer,{wxVERTICAL}),
>  winHtml = create(wxHtmlWindow,{Win})
> 
> set_sizer(pnlHtml,boxHtml)
> set_size(winHtml,win_width,win_height)
> add_window_to_sizer(boxHtml,winHtml,1,wxGROW,0)
> 
> -- Win is the main wxPanel. It has a bunch of widgets on it.
> -- winHtml is on top of Win, same dimensions and position.
> -- Win is completely covered by winHtml.
> -- So far winHtml looks good on both Ubuntu and Vista.
> </eucode>
{{{


I think that the problem is that the parent-child relationships are 
incorrect.  winHtml is parented to Win, but it's put into the sizer for
pnlHtml, which is the panel for a different frame.

In any case, this code doesn't run.  If fixing the parent-child relationship
(or maybe putting it into a different sizer) don't help, then please
refactor this into a working, minimal program that displays the problem
behavior, and I'll take another look at it.

Matt

new topic     » goto parent     » topic index » view message » categorize

5. Re: wxEuphoria - wxHtmlWindow vs Vista

Matt Lewis wrote:
> 
> I think that the problem is that the parent-child relationships are 
> incorrect.  winHtml is parented to Win, but it's put into the sizer for
> pnlHtml, which is the panel for a different frame.
> 
> In any case, this code doesn't run.  If fixing the parent-child relationship
> (or maybe putting it into a different sizer) don't help, then please
> refactor this into a working, minimal program that displays the problem
> behavior, and I'll take another look at it.
> 
> Matt


Here it is.

constant
 PROGRAM_TITLE = "This is a test of wxHtmlWindow."

include wxeud.e

constant
 win_width = 500,
 win_height = 500,
 frmWin = create(wxFrame,{0,-1, PROGRAM_TITLE, 0, 0, win_width, win_height}),
 Win = create( wxPanel, {frmWin}),
 boxMain = create(wxBoxSizer,{wxVERTICAL})

set_sizer(Win,boxMain)


constant
btnShowHtml = create(wxButton,{Win,-1,"Click on this to show the html
 window."}),
 lblJunk = create(wxStaticText,{Win,-1,"This is a label."}),
 txtJunk =create(wxTextCtrl,{Win,-1,"This is a text control."})

add_window_to_sizer(boxMain,btnShowHtml,1,wxGROW,0)
add_window_to_sizer(boxMain,lblJunk,1,wxGROW,0)
add_window_to_sizer(boxMain,txtJunk,1,wxGROW,0)


constant
 frmHtml = create(wxFrame,{Win,-1,"Test wxHtmlWindow"}),
 pnlHtml = create(wxPanel,{frmHtml}),
 boxHtml = create(wxBoxSizer,{wxVERTICAL}),
 winHtml = create(wxHtmlWindow,{Win})

set_sizer(pnlHtml,boxHtml)
set_size(winHtml,win_width,win_height)
add_window_to_sizer(boxHtml,winHtml,1,wxGROW,0)


procedure show_doc(integer display)
  if (display = 1) then
    html_append (winHtml,"<P align= \"center\" >"
      & "ESC or SPACE or click to exit"
      & "<br> "
      & "<br><br>")
  end if
  show_window(winHtml,display)
end procedure -- show_doc()
show_doc(0)

procedure closeHtmlESC(atom this, atom event_type, atom id, atom event)
  show_window(winHtml,0)
end procedure
set_event_handler(winHtml,-1,wxEVT_CHAR, routine_id("closeHtmlESC"))
set_event_handler(winHtml,-1,wxEVT_LEFT_UP, routine_id("closeHtmlESC"))


procedure load_html_stuff()
sequence mess

  mess = "<html>"
  & "<body bgcolor=\"#ffffbb\" text=\"#000055\">"
  & "<B>"
  & "<FONT size = 3 >"
  & "<P align= \"center\" >"
  & "<FONT size= 5 color= \"#aa5511\">This is the wxHtmlWindow.</FONT>"
  & "<P align= \"left\" >"

  & "<br><br> On Ubuntu, this works correctly."
  & "<br> <br> On Vista, clicking on this does not work correctly."
  & "<br>"

  & "</B>"
  & "</body></html>"

  set_html_page(winHtml,mess)
  show_doc(1)
  set_focus(winHtml)
end procedure


procedure showHtml(atom this, atom event_type, atom id, atom event)
  load_html_stuff()
end procedure
set_event_handler(btnShowHtml,-1,wxEVT_COMMAND_BUTTON_CLICKED,
routine_id("showHtml"))


wxMain(frmWin)


new topic     » goto parent     » topic index » view message » categorize

6. Re: wxEuphoria - wxHtmlWindow vs Vista

Jerry Story wrote:
> 
> Matt Lewis wrote:
> > 
> > I think that the problem is that the parent-child relationships are 
> > incorrect.  winHtml is parented to Win, but it's put into the sizer for
> > pnlHtml, which is the panel for a different frame.
> > 
> > In any case, this code doesn't run.  If fixing the parent-child relationship
> > (or maybe putting it into a different sizer) don't help, then please
> > refactor this into a working, minimal program that displays the problem
> > behavior, and I'll take another look at it.
> > 
> > Matt
> 
> 
> Here it is.

This is very strange.  What is the point of frmHtml and pnlHtml?  I don't 
understand why winHtml gets added to the sizer for pnlHtml, even though
it's not a child of pnlHtml.

The problem with the event is that the widgets underneath the html window
are getting the clicks.  I think the solution is probably to have a main
sizer for the Win panel, and have a sizer for the widgets, and a sizer for
the html window.  Then you can probably use the wxSizer::Hide() routine (not
wrapped yet) to get the effect you desire.

I'll have to fill out the sizer wrappers.  There is a fair amount of  
functionality to be added in that area.

Matt

new topic     » goto parent     » topic index » view message » categorize

7. Re: wxEuphoria - wxHtmlWindow vs Vista

Matt Lewis wrote:
> 
> Jerry Story wrote:
> > 
> > Here it is.
> 
> This is very strange.  What is the point of frmHtml and pnlHtml?  I don't 
> understand why winHtml gets added to the sizer for pnlHtml, even though
> it's not a child of pnlHtml.

That shows how confused I am about wxFrames and wxPanels and sizers.
Here is a revised version without those useless things.

constant
 PROGRAM_TITLE = "This is a test of wxHtmlWindow, revised."

include wxeud.e

constant
 win_width = 500,
 win_height = 500,
 frmWin = create(wxFrame,{0,-1, PROGRAM_TITLE, 0, 0, win_width, win_height}),
 Win = create( wxPanel, {frmWin}),
 boxMain = create(wxBoxSizer,{wxVERTICAL})

set_sizer(Win,boxMain)


constant
btnShowHtml = create(wxButton,{Win,-1,"Click on this to show the html
 window."}),
 lblJunk = create(wxStaticText,{Win,-1,"This is a label."}),
 txtJunk =create(wxTextCtrl,{Win,-1,"This is a text control."})

add_window_to_sizer(boxMain,btnShowHtml,1,wxGROW,0)
add_window_to_sizer(boxMain,lblJunk,1,wxGROW,0)
add_window_to_sizer(boxMain,txtJunk,1,wxGROW,0)


constant
 winHtml = create(wxHtmlWindow,{Win})

set_size(winHtml,win_width,win_height)


procedure show_doc(integer display)
  if (display = 1) then
    html_append (winHtml,"<P align= \"center\" >"
      & "ESC or SPACE or click to exit"
      & "<br> "
      & "<br><br>")
  end if
  show_window(winHtml,display)
end procedure -- show_doc()
show_doc(0)

procedure closeHtmlESC(atom this, atom event_type, atom id, atom event)
  show_window(winHtml,0)
end procedure
set_event_handler(winHtml,-1,wxEVT_CHAR, routine_id("closeHtmlESC"))
set_event_handler(winHtml,-1,wxEVT_LEFT_UP, routine_id("closeHtmlESC"))


procedure load_html_stuff()
sequence mess

  mess = "<html>"
  & "<body bgcolor=\"#ffffbb\" text=\"#000055\">"
  & "<B>"
  & "<FONT size = 3 >"
  & "<P align= \"center\" >"
  & "<FONT size= 5 color= \"#aa5511\">This is the wxHtmlWindow.</FONT>"
  & "<P align= \"left\" >"

  & "<br><br> On Ubuntu, this works correctly."
  & "<br> <br> On Vista, clicking on this does not work correctly."
  & "<br>"

  & "</B>"
  & "</body></html>"

  set_html_page(winHtml,mess)
  show_doc(1)
  set_focus(winHtml)
end procedure


procedure showHtml(atom this, atom event_type, atom id, atom event)
  load_html_stuff()
end procedure
set_event_handler(btnShowHtml,-1,wxEVT_COMMAND_BUTTON_CLICKED,
routine_id("showHtml"))


wxMain(frmWin)

 
> The problem with the event is that the widgets underneath the html window
> are getting the clicks.  I think the solution is probably to have a main
> sizer for the Win panel, and have a sizer for the widgets, and a sizer for
> the html window.  Then you can probably use the wxSizer::Hide() routine (not
> wrapped yet) to get the effect you desire.
> 
> I'll have to fill out the sizer wrappers.  There is a fair amount of  
> functionality to be added in that area.
> 
> Matt

new topic     » goto parent     » topic index » view message » categorize

8. Re: wxEuphoria - wxHtmlWindow vs Vista

Jerry Story wrote:
> 
> Matt Lewis wrote:
> > 
> > Jerry Story wrote:
> > > 
> > > Here it is.
> > 
> > This is very strange.  What is the point of frmHtml and pnlHtml?  I don't 
> > understand why winHtml gets added to the sizer for pnlHtml, even though
> > it's not a child of pnlHtml.
> 
> That shows how confused I am about wxFrames and wxPanels and sizers.
> Here is a revised version without those useless things.
> 

That looks a lot better.  What you might try is hiding all of the controls
that are 'underneath' the html when it's shown.  I've been working on 
wrapping more of the sizer stuff, and I came up with a better solution.
The problem with your code is that the html won't resize with the main
window. With the new sizer code, you can get both, and it's actually
easier to do.

I'm thinking it's about time to start pushing v0.12 out the door, so I'll
probably post a beta release this weekend, so people can start testing 
it.  Here's the change log:

--v0.12.0 - /wxBookCtrl: /wxChoiceBook, /wxListBook, /wxToolBook, /wxTreeBook
--        - /wxPlatformInfo
--        - Added /w_sprintf, /from_utf8, /to_utf8 to properly format unicode
strings.
--        - Fixed /wx_printf to use w_sprintf instead of built-in sprintf
--        - Fixed /set_event_handler() for wxGTK and /wxMenu event handling to
not
--           require the parent window of the menu to be passed
--        - Added /enable_tooltips, /set_tooltip_delay
--        - Added wrappers for /Sizers

Once that's out, here's the version of your code that I worked out:
constant
 PROGRAM_TITLE = "This is a test of wxHtmlWindow."

include wxeud.e

constant
 win_width = 500,
 win_height = 500,
 frmWin = create(wxFrame,{0,-1, PROGRAM_TITLE, 0, 0, win_width, win_height}),
 Win = create( wxPanel, {frmWin}),
 boxMain = create(wxBoxSizer,{wxVERTICAL}),
 boxWidgets = create( wxBoxSizer,{wxVERTICAL})

constant
btnShowHtml = create(wxButton,{Win,-1,"Click on this to show the html
 window."}),
 lblJunk = create(wxStaticText,{Win,-1,"This is a label."}),
 txtJunk =create(wxTextCtrl,{Win,-1,"This is a text control."})

constant
 boxHtml = create(wxBoxSizer,{wxVERTICAL}),
 winHtml = create(wxHtmlWindow,{Win})

add_window_to_sizer(boxWidgets,btnShowHtml,1,wxGROW,0)
add_window_to_sizer(boxWidgets,lblJunk,1,wxGROW,0)
add_window_to_sizer(boxWidgets,txtJunk,1,wxGROW,0)

add_window_to_sizer(boxHtml,winHtml,1,wxGROW,0)

add_sizer_to_sizer(boxMain, boxWidgets, 1, wxGROW, 0 )
add_sizer_to_sizer(boxMain, boxHtml, 1, wxGROW, 0 )

set_sizer(Win,boxMain)


procedure show_doc(integer display)
  if (display = 1) then
    html_append (winHtml,"<P align= \"center\" >"
      & "ESC or SPACE or click to exit"
      & "<br> "
      & "<br><br>")
  end if
  show_sizer_item( boxMain, boxHtml, display, 1 )
  show_sizer_item( boxMain, boxWidgets, 1-display, 1 )
  layout_sizer( boxMain )
end procedure -- show_doc()
show_doc(0)

procedure closeHtmlESC(atom this, atom event_type, atom id, atom event)
--   show_window(winHtml,0)
	show_doc(0)
end procedure
set_event_handler(winHtml,-1,wxEVT_CHAR, routine_id("closeHtmlESC"))
set_event_handler(winHtml,-1,wxEVT_LEFT_UP, routine_id("closeHtmlESC"))


procedure load_html_stuff()
sequence mess

  mess = "<html>"
  & "<body bgcolor=\"#ffffbb\" text=\"#000055\">"
  & "<B>"
  & "<FONT size = 3 >"
  & "<P align= \"center\" >"
  & "<FONT size= 5 color= \"#aa5511\">This is the wxHtmlWindow.</FONT>"
  & "<P align= \"left\" >"

  & "<br><br> On Ubuntu, this works correctly."
  & "<br> <br> On Vista, clicking on this does not work correctly."
  & "<br>"

  & "</B>"
  & "</body></html>"

  set_html_page(winHtml,mess)
  show_doc(1)
  set_focus(winHtml)
end procedure

procedure showHtml(atom this, atom event_type, atom id, atom event)
  load_html_stuff()
end procedure
set_event_handler(btnShowHtml,-1,wxEVT_COMMAND_BUTTON_CLICKED,
routine_id("showHtml"))


wxMain(frmWin)


new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu