Created
February 19, 2015 12:29
-
-
Save rusted/e1b51ec7d4fba431edc0 to your computer and use it in GitHub Desktop.
eugenkiss/7guis Erlang with wxErlang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(counter). | |
-include_lib("wx/include/wx.hrl"). | |
-export([start/0]). | |
itl(Int) -> | |
erlang:integer_to_list(Int). | |
lti(L) -> | |
erlang:list_to_integer(L). | |
increment(Text) -> | |
wxStaticText:setLabel(Text, itl((lti(wxStaticText:getLabel(Text)) + 1))). | |
start() -> | |
Wx = wx:new(), | |
Frame = wxFrame:new(Wx, 1, "Counter",[{size, {150,50}}]), | |
Text = wxStaticText:new(Frame, 2, "0", [{pos, {10,5}}]), | |
Button = wxButton:new(Frame, 3, [{label, "Click"},{pos,{50,0}}]), | |
CB = [{callback, fun(_,_) -> increment(Text) end}], | |
wxFrame:connect(Button, command_button_clicked, CB), | |
wxFrame:show(Frame). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment