Re: wxEuphoria - wxHtmlWindow vs Vista

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu