Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#26 16-Sep-2014 14:30:08

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Text Input/Output plugit

it works...although I haven't made the input/output windows children of the os3d window, will try to do that on the weekend.
if you type text into one window, it appears in the other. my first plugit that can actually be used with other plugits!

thanks arkeon and iri!
http://www.ifam.net/chatwindow2/web/index.html

Last edited by hebdemnobad (16-Sep-2014 14:35:29)

Offline

#27 17-Sep-2014 14:12:50

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Text Input/Output plugit

I fixed the window order with different flags (using WN_TOPMOST)and now the input/output windows appear in front of the browser embedded os3d scene:

http://www.ifam.net/chatwindow3/web/index.html

I like this more than integrating chat in the browser since I don't have to worry about cross browser functionality.  Next I will add a 'hide' and 'show' action to the window so the user can toggle it on and off using the keydown plugit

Offline

#28 17-Sep-2014 17:40:02

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: Text Input/Output plugit

yes it's working smile

Offline

#29 24-Sep-2014 20:45:06

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Text Input/Output plugit

yay...I took my first step to making a plugit that someone else can actually use.  All I've done so far is allow the user to set the width of a text input/output window.  It gets saved to the .xos file and when I reopen the .xos, the changed width parameter is preserved.  One bug though and it's probably me....the editor file sets the width to 800 if the user doesn't do anything to change it. however, unless I re-enter '800' in the width field, the resulting window has a width of 0 pixels. I must not be doing something correctly....
.xml file, with just one configurable parameter:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<PLUGIN name="chatwindow" version="1.0" type="misc">

  <DESCRIPTION>Chat Window Plugit</DESCRIPTION>

  <HELP>Template plugIT help</HELP>

  <EDITOR>

    <SCRIPT path="./echatwindow.pkg" />

    <PARAM name="width" type="value" />

  </EDITOR>

  <CLIENT minstance="true">

    <SCRIPT path="./cchatwindow.pkg" />

    <ACTION name="Print Incoming Message">
    </ACTION>

    <EVENT name="Send Outgoing Message">
    </EVENT>

  </CLIENT>

</PLUGIN>

editor file...this has that bug I mentioned above:

// prototype of the cbCloseEdit function in case you don't use params

//proto cbCloseEdit = fun [] [[S S] r1];;

//proto cbCloseEdit = fun [u0] [[S S] r1];;

// Close callback called on apply / Ok button, this callback return the parameters to save in the XOS project

fun cbCloseEdit(ctrlwinw)=
  //get width value set in editor
  let ftoi getEdCtrlFloatValue ctrlwinw -> width in
  //change width value from integer to string and save in xos file
  ["width" itoa width]::
  nil;;





// Destroy callback called when the editor window is destroyed, this is useful to destroy added objects or resources

fun cbDestroyEdit()=

  0;;





// Init function called when a user the plugIT Editor

fun dynamicedit(winstr, inst, viewstr) =
  //get width value from .xos file

  let atof (getPluginInstanceParam inst "width") -> width in
  //if width not set, set it to 800
  let if width == nil then 800.0 else width -> width in 
  // size of the window
  let [400 90] -> [iw ih] in
  let 10 -> ypos in
  //create window width label
  let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 170 20 "Window width" nil -> labelwinw in

  //create window width float control
  let crEdCtrlFloat winstr 190 ypos 100 20 width 0.0 12000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlwinw in
  (
    // resize the editor window
    setEdWindowSize winstr iw ih;
    
    [mkfun1 @cbCloseEdit ctrlwinw  @cbDestroyEdit];
  );;

the client file, seems to be working fine I think but maybe the width bug is here though

//struct definition
  struct Chatwindow = [
  CHATwindow_plugin_instance           				: PInstance,
  CHATwindow_window_object_container					: ObjContainer,  
  CHATwindow_parent_chat_window							: ObjWin,
  CHATwindow_chat_font										: ObjFont,
  CHATwindow_ongoing_chat_textfield						: CompText,
  CHATwindow_chat_entry_textfield						: CompText
  				
  ]mkChatwindow;;
  
 fun printmessage(constr, value)=
	_ADDcompText constr.CHATwindow_ongoing_chat_textfield strcatn value:: "":: "\n"::nil constr.CHATwindow_chat_font [0x00FFFF 0 0 0xFFFF00] CT_END;
	_PAINTcontainer constr.CHATwindow_window_object_container;
 0;;
 
 fun cbprintmessage(inst, from, action, param, reply, constr)=
 	printmessage constr param;
 	0;;
 

fun cbDestroy(inst, from, action, param, reply, constr)=
	_DScompText constr.CHATwindow_ongoing_chat_textfield;
	_DScompText constr.CHATwindow_chat_entry_textfield;
	_DSfont constr.CHATwindow_chat_font;
	_DScontainer constr.CHATwindow_window_object_container;
	_DSwindow constr.CHATwindow_parent_chat_window;

0;;

fun deleteOb(inst, constr)=

  cbDestroy inst nil nil nil nil constr;

  0;;

//add text to ongoing_chat_textfield here
fun addtext(textobject, user_parameter,type,value)=
	//update contents of chat interface
	let ""-> empty_text_value in
		(
			_ADDcompText user_parameter.CHATwindow_ongoing_chat_textfield strcatn value:: "":: "\n"::nil user_parameter.CHATwindow_chat_font [0x00FFFF 0 0 0xFFFF00] CT_END;
			_PAINTcontainer user_parameter.CHATwindow_window_object_container;
  			_SETcompText textobject "" user_parameter.CHATwindow_chat_font [0x00FFFF 0 0 0xFFFF00] CT_BEGIN; 

			_PAINTcontainer user_parameter.CHATwindow_window_object_container;
			 _DMSevent this (getPluginInstanceEvent user_parameter.CHATwindow_plugin_instance "Send Outgoing Message") value nil;
			0;
		);
0;;
///create plugit function
fun newOb(inst)=
   let atoi (getPluginInstanceParam inst "width") -> width in
	let _CRwindow _channel DMSwin 0 450 width 150 WN_TOPMOST "A window"  -> thisparentchatwindow in
	let _CRcontainerFromObjWin _channel thisparentchatwindow 0 0 800 150 CO_CHILDINSIDE 0x000000 "hackerwindow" -> thiscontainer in
	//let......code here to make fatherwindow here -> thisfatherwindow in
	let _CRfont _channel 12 0 0 "Lucida Console"-> thisfont in
	let  _CRcompText _channel thiscontainer  nil [0 101] OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_WORDWRAP|CT_EDITLINE 0 800 50  "text entry field" 		thisfont [0x00FFFF 0 0 0xFFFF00] [0xFFFFFF 50] nil nil   -> thistextentryfield in
	let _CRcompText _channel thiscontainer nil [0 0] OBJ_ENABLE|OBJ_VISIBLE|CT_LEFT|CT_LABEL|CT_WORDWRAP|CT_LABEL|CT_SELECT OBJ_CONTAINER_KEYDOWN 800 100  strcat "text entry here"  "\n" thisfont [0x00FFFF 0 0 0xFFFF00] [0xFFFFFF 50] nil nil-> thisongoingchatfield in
	
	let mkChatwindow [inst thiscontainer thisparentchatwindow thisfont thisongoingchatfield thistextentryfield]->constr in
		(


			_CBcompTextValidation constr.CHATwindow_chat_entry_textfield @addtext constr  CT_VALIDENTER;
			_PAINTcontainer constr.CHATwindow_window_object_container;
			PluginRegisterAction inst "Print Incoming Message" mkfun6 @cbprintmessage constr;
			//PluginRegisterAction inst "Destroy" mkfun6 @cbDestroy constr;

			setPluginInstanceCbDel inst mkfun2 @deleteOb constr;

		);
0;;



fun IniPlug(file)=

  PlugRegister @newOb nil;

  setPluginEditor @dynamicedit;

  0;;
  
  

Last edited by hebdemnobad (24-Sep-2014 20:48:56)

Offline

#30 24-Sep-2014 20:51:44

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Text Input/Output plugit

Offline

#31 25-Sep-2014 18:13:18

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: Text Input/Output plugit

good smile do you still have the issue with the width of the window ? I don't see the problem in the code.

Offline

#32 26-Sep-2014 12:38:15

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: Text Input/Output plugit

It seems me ok smile

Offline

#33 30-Sep-2014 20:21:00

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Text Input/Output plugit

no I haven't had an issue with the window...when I have time I'll upload the updated files.

Offline

#34 2-Oct-2014 23:53:37

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Text Input/Output plugit

for what it's worth, i posted an environment that runs this plugit:
http://www.ifam.net/openspace/chatwindo … index.html

Offline

#35 10-Oct-2014 15:37:57

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: Text Input/Output plugit

I've been adding functions to the plugit editor.... I think the next step will give the author option of spawning a new window or altering the player ui to put text input/output under 3d buffer.

Offline

Board footer

Powered by FluxBB