そのFrame画面内に、wxStaticTextでFrameの幅と高さを表示させるサンプル。
表示画面:
ソース:
-module(getSize).
-export([start/0]).
-include_lib("wx.hrl").
start()->
Wx = wx:new(),
Frame = wx:batch(fun()->create_window(Wx) end),
wxWindow:show(Frame),
loop(),
%wx:destory(),
ok.
create_window(Wx)->
Option = [ { size, {310, 100 } } ],
Frame = wxFrame:new(Wx,
?wxID_ANY,
"show Size of Display!",
Option),
%% get size
[ { size, {X ,Y } } ] = Option,
Width = string:concat("width = ", integer_to_list(X)),
Height = string:concat("height = ", integer_to_list(Y)),
%% create text
OPST1 = [{pos, {110,10}}],
OPST2 = [{pos, {110,30}}],
wxStaticText:new( Frame, 1 , Width, OPST1),
wxStaticText:new( Frame, 2 , Height, OPST2),
wxFrame:connect( Frame, close_window ),
Frame.
loop()->
receive
#wx{ obj = Obj, event = #wxClose{ type = close_window } } ->
io:format("~p Closing window ~n",[self()]),
wxWindow:destroy(Obj),
ok
end.
0 件のコメント:
コメントを投稿