Heres a couple of small snippets from one of my old screens how I did a button
local sethome_btn_dis = btn_path.."sethome_dis.png"
local sethome_btn_dwn = btn_path.."sethome_dwn.png"
local sethome_btn_up = btn_path.."sethome_up.png"
local sethome_btn_hov = btn_path.."sethome_hov.png"
Cont.sethome_btn = wx.wxBitmapButton( Cont.Panel, wx.wxID_ANY, wx.wxBitmap( sethome_btn_up, wx.wxBITMAP_TYPE_ANY ), wx.wxPoint(10,440), wx.wxDefaultSize, wx.wxBU_AUTODRAW + wx.wxNO_BORDER)
Cont.sethome_btn:SetBackgroundColour( wx.wxSystemSettings.GetColour( wx.wxSYS_COLOUR_ACTIVECAPTION ) )
Cont.sethome_btn:SetBitmapDisabled( wx.wxBitmap( sethome_btn_dis, wx.wxBITMAP_TYPE_ANY ) )
Cont.sethome_btn:SetBitmapSelected( wx.wxBitmap( sethome_btn_dwn, wx.wxBITMAP_TYPE_ANY ) )
Cont.sethome_btn:SetBitmapFocus( wx.wxBitmap( sethome_btn_up, wx.wxBITMAP_TYPE_ANY ) )
Cont.sethome_btn:SetBitmapHover( wx.wxBitmap( sethome_btn_hov, wx.wxBITMAP_TYPE_ANY ) )
--Cont.sethome_btn:SetToolTip( "Cycle Start" )
Cont.sethome_btn:Connect( wx.wxEVT_LEFT_UP, function(event)
event:Skip()
end )
Now another way of doing it is to use one of your images as a container for a second image then use the :Show() and :Hide() functions - notice in the example below that the button_up is loaded over the button_dwn, by hiding button_up then you see button_dwn and by showing it you hide button down..
--************************** Start Controls *********************************
DTG.panel = mcLuaPanelParent
DTG.bSizer1 = wx.wxBoxSizer( wx.wxVERTICAL )
DTG.button_dwn = wx.wxStaticBitmap( DTG.panel, wx.wxID_ANY, wx.wxBitmap( btn_dwn, wx.wxBITMAP_TYPE_ANY ), wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
DTG.button_up = wx.wxStaticBitmap( DTG.button_dwn, wx.wxID_ANY, wx.wxBitmap( btn_up, wx.wxBITMAP_TYPE_ANY ), wx.wxDefaultPosition, wx.wxDefaultSize, 0 )
DTG.bSizer1:Add( DTG.button_dwn, 0, wx.wxALL, 0 )
DTG.panel:SetSizer( DTG.bSizer1 )
DTG.panel:Layout()
--*************************** End Controls **************************************
--************************** Start Event Handlers *********************************
DTG.button_up:Connect( wx.wxEVT_LEFT_DOWN, function(event)
DTG.button_up:Hide();
end )
DTG.button_dwn:Connect( wx.wxEVT_LEFT_UP, function(event)
DTG.button_up:Show();
end )
DTG.button_dwn:Connect( wx.wxEVT_LEAVE_WINDOW, function(event)
DTG.button_up:Show();
end )
--*************************** End Event Handlers *********************************
DazTheGas