#!/home/matt/euphoria/bin/exu -- Display Bitmaps In Window -- Change Control's Font with trace without warning include wxEuphoria.e include wxButton.e include wxGraphics.e ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- controls constant -- the window MyFrame = create( wxFrame,{0,-1, "Test Window", -1,-1, 200, 100, wx_or_all({wxDEFAULT_FRAME_STYLE,wxCLIP_CHILDREN})} ), MyWindow = create( wxPanel, {MyFrame}), -- create a control in the window MyButton = create( wxButton, {MyWindow, wxID_OK, "OK", 10, 10, 80, 40} ), -- load the bitmap hBitmap = create( wxBitmap, {BM_FROM_FILE, "tiles.bmp", wxBITMAP_TYPE_BMP}), TNR1 = create( wxFont, {10,wxROMAN,wxNORMAL,wxNORMAL,0,"Times New Roman"}), TNR2 = create( wxFont, {18,wxROMAN,wxNORMAL,wxNORMAL,0,"Times New Roman"}) integer FirstFont -- a flag FirstFont = 1 -- yes, first font set_default_font( MyButton, TNR1 ) ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- actions procedure onPaint_MyWindow( atom this, atom id, atom event_type, atom event ) sequence extent atom dc dc = create(wxPaintDC, {this}) -- get the window size extent = get_client_size( MyWindow ) -- fill with the 32x32 bitmap for i = 0 to extent[1] by 32 do for j = 0 to extent[2] by 32 do draw_bitmap( dc, hBitmap, i, j, 0) end for end for delete_instance( dc ) --refresh_window( MyButton ) end procedure set_event_handler( MyWindow, get_id(MyWindow), wxEVT_PAINT, routine_id("onPaint_MyWindow")) ----------------------------------------------------------------------------- procedure no_erase(atom this, atom id, atom event_type, atom event ) end procedure set_event_handler( MyWindow, get_id(MyWindow), wxEVT_ERASE_BACKGROUND, routine_id("no_erase")) ----------------------------------------------------------------------------- procedure onClick_MyButton(atom this, atom id, atom event_type, atom event) -- change the font if FirstFont = 1 then set_default_font( MyButton, TNR2 ) FirstFont = 0 else set_default_font( MyButton, TNR1 ) FirstFont= 1 end if end procedure set_event_handler( MyButton, wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, routine_id("onClick_MyButton")) ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- -- hand control over to Windows wxMain( MyFrame )