I’m trying to place a simple logo on one of the panels within the center
of my main gui. In DialogBlocks, the panel class is LogoPanel which
when using xrcise to generate the ruby file from xrc, creates:
@logo = finder.call(“logo”)
@logo.extend(LogoPanel)
In my main loop I have:
class GuiMain < XrcFrameMain
def initialize
super()
evt_menu( @mb_fm_new, :on_new_workspace )
evt_menu( @mb_fm_save, :on_save_workspace )
evt_menu( @mb_fm_exit, :on_exit )
st_response(“Idle…”,2)
st_response(Time.now.strftime("%B %d, %Y"), 1)
end
end
module LogoPanel
logo image
img_file = File.join( File.dirname(FILE)+"/…/images/kirin",
‘logo.png’)
@bitmap = Wx::Bitmap.new(img_file, Wx::BITMAP_TYPE_PNG)
self.paint do |dc|
dc.draw_line(@bitmap, @offset, @offset, false)
end
end
which generates the following error:
E:\Gui-Development\Kirin>ruby start
E:/Gui-Development/Kirin/lib/main.rb:25:in <module:LogoPanel>': undefined metho d
paint’ for LogoPanel:Module (NoMethodError)
from E:/Gui-Development/Kirin/lib/main.rb:20:in <top (required)>' from start:12:in
load’
from start:12:in `’
I can’t make the LogoPanel a class because I will receive an error that
it was expecting a module to be there. So, I believe the class for this
particular panel expects a module class. Without this code in there, or
just using:
module LogoPanel
end
… the gui will show but the section where the logo should appear is all
white as it is missing the paint.
This is a rather important topic for me because I’d like to understand
better how to paint and change the appearance of my GUI in many areas…
For instance, I want to add a custom png file as the background of my
entire GUI and then paint the logo on the side, etc. This app will be
used cross platform so the images will have to be converted to a usable
source, which I haven’t gotten into yet.
Any ideas on everything I just posted?
Thanks.