GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  WX_OBJECT (3)

NAME

wx_object - wx_object - Generic wx object behaviour.

CONTENTS

Description
Exports
Authors

DESCRIPTION

wx_object - Generic wx object behaviour

This is a behaviour module that can be used for "sub classing" wx objects. It works like a regular gen_server module and creates a server per object.

NOTE: Currently no form of inheritance is implemented.

The user module should export:

init(Args) should return
{wxObject, State} | {wxObject, State, Timeout} | ignore | {stop, Reason}

handle_call(Msg, {From, Tag}, State) should return
{reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State}

Asynchronous window event handling:
handle_event(#wx{}, State) should return
{noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Info is message e.g. {’EXIT’, P, R}, {nodedown, N}, ...
handle_info(Info, State) should return , ...
{noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

When stop is returned in one of the functions above with Reason = normal | shutdown | Term, terminate(State) is called. It lets the user module clean up, it is always called when server terminates or when wxObject() in the driver is deleted. If the Parent process terminates the Module:terminate/2 function is called.
terminate(Reason, State)

Example:

  -module(myDialog).
  -export([new/2, show/1, destroy/1]).  %% API
  -export([init/1, handle_call/3, handle_event/2,
           handle_info/2, code_change/3, terminate/2]).
           new/2, showModal/1, destroy/1]).  %% Callbacks

%% Client API new(Parent, Msg) -> wx_object:start(?MODULE, [Parent,Id], []).

show(Dialog) -> wx_object:call(Dialog, show_modal).

destroy(Dialog) -> wx_object:call(Dialog, destroy).

%% Server Implementation ala gen_server init([Parent, Str]) -> Dialog = wxDialog:new(Parent, 42, "Testing", []), ... wxDialog:connect(Dialog, command_button_clicked), {Dialog, MyState}.

handle_call(show, _From, State) -> wxDialog:show(State#state.win), {reply, ok, State}; ... handle_event(#wx{}, State) -> io:format("Users clicked button~n",[]), {noreply, State}; ...

EXPORTS

start(Name, Mod, Args, Options) -> wxWindow() (see module wxWindow)

Types:

Name = {local, atom()}
Mod = atom()
Args = term()
Options = [{timeout, Timeout} | {debug, [Flag]}]
Flag = trace | log | {logfile, File} | statistics | debug

Starts a generic wx_object server and invokes Mod:init(Args) in the new process.

start_link(Mod, Args, Options) -> wxWindow() (see module wxWindow)

Types:

Mod = atom()
Args = term()
Options = [{timeout, Timeout} | {debug, [Flag]}]
Flag = trace | log | {logfile, File} | statistics | debug

Starts a generic wx_object server and invokes Mod:init(Args) in the new process.

start_link(Name, Mod, Args, Options) -> wxWindow() (see module wxWindow)

Types:

Name = {local, atom()}
Mod = atom()
Args = term()
Options = [{timeout, Timeout} | {debug, [Flag]}]
Flag = trace | log | {logfile, File} | statistics | debug

Starts a generic wx_object server and invokes Mod:init(Args) in the new process.

stop(Ref::wxObject() | atom() | pid()) -> ok

Stops a generic wx_object server with reason ’normal’. Invokes terminate(Reason,State) in the server. The call waits until the process is terminated. If the process does not exist, an exception is raised.

stop(Ref::wxObject() | atom() | pid(), Reason::term(), Timeout::timeout()) -> ok

Stops a generic wx_object server with the given Reason. Invokes terminate(Reason,State) in the server. The call waits until the process is terminated. If the call times out, or if the process does not exist, an exception is raised.

call(Ref::wxObject() | atom() | pid(), Request::term()) -> term()

Make a call to a wx_object server. The call waits until it gets a result. Invokes handle_call(Request, From, State) in the server

call(Ref::wxObject() | atom() | pid(), Request::term(), Timeout::integer()) -> term()

Make a call to a wx_object server with a timeout. Invokes handle_call(Request, From, State) in server

cast(Ref::wxObject() | atom() | pid(), Request::term()) -> ok

Make a cast to a wx_object server. Invokes handle_cast(Request, State) in the server

get_pid(Ref::wxObject()) -> pid()

Get the pid of the object handle.

reply(From::tuple(), Reply::term()) -> pid()

Get the pid of the object handle.

AUTHORS

<

Search for    or go to Top of page |  Section 3 |  Main Index


WX_OBJECT (3) wx 1.6.1

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.