[erlang-questions] Wx Toolbars in Erlang

Dan Gudmundsson dangud@REDACTED
Mon Jan 14 12:45:48 CET 2013


This works for me (tested on linux)

    Frame = wxFrame:new(Wx, ?wxID_ANY, "Frame"),
    TB = wxFrame:createToolBar(Frame),
    wxToolBar:addTool(TB, 747, "PressMe",
wxArtProvider:getBitmap("wxART_COPY", [{size, {16,16}}]),
		      [{shortHelp, "Press Me"}]),

    Add = fun(#wx{}, _) ->
		  wxToolBar:addTool(TB, -1, "Added",
wxArtProvider:getBitmap("wxART_TICK_MARK", [{size, {16,16}}]),
				    [{shortHelp, "Test 2 popup text"}])
	  end,

    wxFrame:connect(Frame, command_menu_selected, [{callback, Add}, {id, 747}]),
    wxFrame:show(Frame),

/Dan
On Mon, Jan 14, 2013 at 9:25 AM, Hosszú Gábor <gabre@REDACTED> wrote:
> Hello,
>
> I have started to implement a GUI for an Erlang software but I have some
> problems with Wx Toolbars. I googled it and searched in the Wx docs but
> found nothing so I think that it may be an Erlang Wx related problem (or I
> am doing something wrong).
>
> I have a window and a toolbar in it which is created at the startup as it is
> shown and coded in the Erlang wx demo (my one has no tools on it). I have to
> add buttons to this toolbar dinamically and remove other buttons so I want
> to alter the whole toolbar dinamically. I have a function which is ran in
> those cases when I have to modify the toolbar:
> my_fun() ->
>     Frame = wx:typeCast(wxWindow:findWindowByName("win"), wxFrame),
>     TB = wxFrame:getToolBar(Frame),
>     BM = wxBitmap:new(...,[{type,?wxBITMAP_TYPE_JPEG}]),
>     wxToolBar:addTool(TB, 1, "label", BM),
>     wxToolBar:realize(TB).
> (and the path at ... is correct and valid)
> I have double checked that my fun is executed but nothing is added to the
> toolbar.
> How can I solve this problem?
>
> Regards,
> Gabor
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list