On Dec 31, 2007 7:44 PM, francisco leite <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>
> im traying to make a TaskBar Control, but im not understand some things
> and there are few examples of use, ... i tried some dumbs events and its
> give right such as Double_Right_Click event and show me a
> window...right, but i want a built-in menu like this:
> http://wiki.wxpython.org/AnotherTutorial?action=AttachFile&do=get&target=taskbaricon.png

This is pretty easy. I think the last binary version of wxLua had a
little problem with the wxTaskBarIcon, but it's fixed now in CVS.

The code below shows the wxTaskBarIcon and pops up a menu when clicked.

------------------------------------
ID_CLICK = 5
ID_CHECK = 6

taskbarIcon = wx.wxTaskBarIcon()
local icon = wx.wxIcon()
local bmp = wx.wxArtProvider.GetBitmap(wx.wxART_INFORMATION,
wx.wxART_TOOLBAR, wx.wxSize(16, 16))
icon:CopyFromBitmap(bmp)
taskbarIcon:SetIcon(icon, "Tooltop for wxTaskBarIcon from controls.wx.lua")
icon:delete()
bmp:delete()

taskbarMenu = wx.wxMenu()
taskbarMenu:Append(ID_CLICK, "Click me", "Please click this", wx.wxITEM_NORMAL)
taskbarMenu:Append(ID_CHECK, "Check me", "Please check this", wx.wxITEM_CHECK)

taskbarIcon:Connect(wx.wxEVT_TASKBAR_LEFT_UP,
    function(event)
        taskbarIcon:PopupMenu(taskbarMenu)
    end)

taskbarIcon:Connect(wx.wxID_ANY, wx.wxEVT_COMMAND_MENU_SELECTED,
    function(event)
        print("Menu item with id = "..tostring(event:GetId()).." was clicked")
    end)
------------------------------------

> that i saw on this site:
> http://wiki.wxpython.org/AnotherTutorial
> So Python is a OO based and Lua is Meta-Based!...it fries my mind
> I Know that you can help me!...Please, if possible post a simple and
> quite example

Lua can be OO if you create a class type using a table and setting
it's metatable. See the Lua wiki for some examples. I think the book
"Programming in Lua" (PIL) has an example, the first version of this
book is on-line.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to