1. wxBitmap - Linux vs Windows, part 2
This is the 2nd minimal program to illustrate the problem.
This time I succeeded in getting it to behave the same way as the original
program (ie, to not work on Windows).
The 1st minimal program works on Windows, this one does not. There doesn't seem
to be any difference between them that would make a difference, but obviously
there is.
-- splash_sample2.exw
-- Replace "bigkick.bmp" with something you have.
----------------------------------------------------------
global constant
PROGRAM_TITLE = "Diet Monger Ass Kicker October 1, 2006 public domain"
----------------------------------------------------------------------------
include wxEuphoria.e
include wxSizer.e
include wxText.e
include wxGraphics.e
global object void
global sequence mess
----------------------------------------------------------------------------
global sequence SLASH,path_dmak
procedure getSLASH()
integer p
p = platform()
if p = LINUX then
SLASH = "/"
else
SLASH = "\\"
end if
end procedure
getSLASH()
function GetPath() -- Get the path that the program is in.
sequence cmd,path
cmd = command_line()
path = ""
for stop = length(cmd[2]) to 1 by -1 do
if cmd[2][stop] = '/' then
path = cmd[2][1..stop]
exit
end if
end for
return path
end function -- GetPath()
path_dmak = GetPath()
--------------------------------------------------------------------
constant
mess1 = "1. Food value depends on digestion and assimilation. \n"
& "2. There is more to health than diet. Too much is claimed for diet. \n"
& "3. Never eat beyond the power to digest! \n"
& "4. The accuracy of food values from USDA has been criticized. \n"
& "5. Quality of food depends on quality of soil. \n"
& "6. Do not take my *.REQ files as reliable! \n"
& "7. Always think for yourself! \n"
global constant
splash_width = 600,
splash_height = 600,
frameWin = create(wxFrame,{0,-1, PROGRAM_TITLE, -1, -1, splash_width,
splash_height}),
Win = create( wxPanel, {frameWin}),
boxMain = create(wxBoxSizer,{wxHORIZONTAL}),
frmSplash = create(wxFrame,{0,-1,"Loading USDA data
...",-1,-1,splash_width,splash_height}),
pnlSplash = create(wxPanel,{frmSplash}),
boxSplash = create(wxBoxSizer,{wxVERTICAL}),
lblSplash1 =
create(wxStaticText,{pnlSplash,-1,mess1,-1,-1,-1,-1,wxALIGN_CENTER_VERTICAL}),
lblSplash2 = create(wxStaticText,{pnlSplash,-1,"..",-1,-1,200,20,
wx_or_all({wxALIGN_CENTER_VERTICAL, wxST_NO_AUTORESIZE})}),
lblSplash3 = create(wxStaticText,{pnlSplash,-1,"..",-1,-1,200,20,
wx_or_all({wxALIGN_CENTER_VERTICAL, wxST_NO_AUTORESIZE})}),
bmpSplash = create(wxBitmap,{BM_FROM_FILE,"bigkick.bmp",wxBITMAP_TYPE_BMP}),
fontSplash = create(wxFont,{14,wxDEFAULT,wxNORMAL,wxNORMAL,0,"Arial"})
set_default_font(lblSplash1,fontSplash)
set_default_font(lblSplash2,fontSplash)
set_default_font(lblSplash3,fontSplash)
set_sizer(pnlSplash,boxSplash)
add_window_to_sizer(boxSplash,lblSplash1,1,wxGROW,0)
add_window_to_sizer(boxSplash,lblSplash2,0,wxGROW,0)
add_window_to_sizer(boxSplash,lblSplash3,0,wxGROW,0)
set_sizer(Win,boxMain)
-----------------------------------------------------------------------------
procedure onPaint_pnlSplash( atom this, atom id, atom event_type, atom event )
sequence extent
atom dc,x,y
dc = create(wxPaintDC, {this})
extent = get_bitmap_size( bmpSplash )
x = (splash_width - extent[1]) / 2
y = ((splash_height - 100) - extent[2]) /2
y += 100
x = floor(x)
y = floor(y)
draw_bitmap( dc, bmpSplash, x, y, 0)
delete_instance( dc )
end procedure
set_event_handler(pnlSplash,get_id(pnlSplash),wxEVT_PAINT,routine_id("onPaint_pnlSplash"))
-----------------------------------------------------------------------------
global integer win_width,win_height
win_width = 800
win_height = 600
constant TIME_TO_READ = 2
show_window(frmSplash,1)
for i = 1 to 3 do
void = call_member( wxApp_Yield, myApp_this, {1})
end for
sleep(TIME_TO_READ)
delete_instance(frmSplash)
----------------------------------------------------------------------------
set_size(frameWin,win_width,win_height)
wxMain( frameWin )
2. Re: wxBitmap - Linux vs Windows, part 2
I did some testing of both of those code pages and I found out that the bitmap
is actually printing to the page.
However, one of your sizers was immediately going over it which gave the
appearance of having never loaded.
add_window_to_sizer(boxSplash,lblSplash1,1,wxGROW,0)
I changed that 1 in the middle to a 0 and it rendered perfectly.
3. Re: wxBitmap - Linux vs Windows, part 2
Jesse Adkins wrote:
>
> I did some testing of both of those code pages and I found out that the bitmap
> is actually printing to the page.
>
> However, one of your sizers was immediately going over it which gave the
> appearance of having never loaded.
>
> add_window_to_sizer(boxSplash,lblSplash1,1,wxGROW,0)
>
> I changed that 1 in the middle to a 0 and it rendered perfectly.
Thanks.