/**/

signal on halt
signal on break_c

l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
if AddLibrary("rxmui.library")~=0 then exit

call RxMUIOpt("debugmode showerr")
call CreateApp

call HandleApp
/* never reached */
/***********************************************************************/
HandleApp: procedure

	ctrl_c=2**12
	do forever
		call NewHandle("app","h",ctrl_c)
		if and(h.signals,ctrl_c)>0 then exit
		select
			when h.event="QUIT" then exit
			otherwise interpret h.event
		end
	end
	/* never reached */
/***********************************************************************/
err: procedure expose sigl rxmuierror
parse arg res
say sigl "["res"]"
	say getrxmuistring(res) "in line" sigl-1 rxmuierror
	exit
/***********************************************************************/
CreateApp: procedure

		 pw.class="window"
		 pw.Title="PopstringWindow"
		 pw.ID="SHOW"
		 pw.refwin="win"
		  pw.Contents="pwmain"
 	       pwmain.0=Button("cs",'_Button')
	res=NewObj("window","pw")
	if res~=0 then call err(res)

	app.Title="PopstringExample"
	app.Version="$VER: PopstringExample 1.0 (12.10.2000)"
	app.Copyright="©2000, alfie"
	app.Author="alfie"
	app.Description="PopstringExample"
	app.Base="RXMUIEXAMPLE"
	app.SubWindow="WIN"
	 win.Title="PopstringExample"
	 win.ID="MAIN"
	 win.Contents="mgroup"

	  mgroup.0="G"
	   g.class="group"
	   g.horiz=1
	   g.0="ps"
		ps.class="popstring"
		ps.toggle=1
		ps.string=String("S")
		ps.button=Button("BS","Pop!")
		ps.window="pw"

	res=NewObj("APPLICATION","APP")
	if res~=0 then call err(res)

	call notify("win","CloseRequest",1,"app","ReturnID","quit")
	call notify("ps","open",1,"app","return","say 'pop opened'")

/*
	call notify("ps","open",1,"app","return","say 'pop opened'")

	call notify("ps","open",0,"app","return","say 'pop closed'")

	call notify("ps","success",1,"app","return","say 'pop closed with succedd'")
	call notify("ps","success",0,"app","return","say 'pop closed with failure'")

	call notify("pw","CloseRequest",1,"ps","close",0)
	call notify("cs","pressed",0,"ps","close",1)
*/
	call add("app","pw")

	call set("win","open",1)
	call getattr("win","open","o")
	if o=0 then do
		say "can't open window"
		exit
	end

	return
/***********************************************************************/
halt:
break_c:
	say break
	exit
/**************************************************************************/
popofun: procedure
	call DoMethod('list','GetEntry','active','A')
	call set('s','contents',a)
	return
/**************************************************************************/
