XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 9:47 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: October 9th, 2013, 6:59 am 
Offline
User avatar

Joined: June 12th, 2012, 11:05 am
Posts: 257
Location: Barcelona
I'm using the "Msg (,)" as taught me meme. Very good!
I came another problem: I want to send a text from the widget "A" (from "edit1") to the widget "B" (to "text1).
How I can do this???
thank you!


Top
 Profile  
 
PostPosted: October 9th, 2013, 7:56 am 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
You will need some custom code handler to segregate the message. Like a message such as : FROM<EDIT1> TO <LABEL 1> <DO SOMETHING>. Then define a regex that parses the controls and does the job

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: October 9th, 2013, 8:38 am 
Offline
User avatar

Joined: June 12th, 2012, 11:05 am
Posts: 257
Location: Barcelona
Ups!, thanks digigamer!!!... but since I'm not professional of codes... (just hobbyist)... I would not know how to do all that you suggest :(
that's the ugly part of being only "designer" :)


Top
 Profile  
 
PostPosted: October 9th, 2013, 11:02 pm 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
Try this...

In the sender widget
function button1OnClick(Sender)
{
msg("content","receiver"); // content = the text message you want to send, receiver = the name of the widget receiving the message
}

In the receiving widget
function widgetOnMsg(MsgString)
{
text1.text = MsgString; // MsgString equals the content you sent ( the text message ) use it as you like in the receiving widget
}


Top
 Profile  
 
PostPosted: October 10th, 2013, 5:56 am 
Offline
User avatar

Joined: June 12th, 2012, 11:05 am
Posts: 257
Location: Barcelona
YES! this works!
but I want to send action msgs to the same widget, then I done this (some friend of mine helps me)
Each "case" are other orders that I send from main widget to the remote widget trough "msgstring".
The default action is below, at bottom, in red.


function widgetOnMsg(MsgString)
{
var posi = 99
var nom = "nameguy"
var subnom = "titlespeech"

switch (MsgString)
{
case "editlower":
layer1.ScaleTo(0.5,0.5,1,0,2,9);
widget.top = 350;
widget.Left = 30;
break;

case "putlower":
layer1.ScaleTo(1,1,1,0,2,9);
widget.top = 1000;
widget.Left = 1800;
break;

case "downname":
text7.Font.Size = text7.Font.Size -2;
break;

case "upname":
text7.Font.Size = text7.Font.Size +2;
break;


case "zoom1":
layer1.ScaleTo(0.5,0.5,1,0,2,9);
break;

case "zoom2":
layer1.ScaleTo(0.7,0.7,1,0,2,9);
break;

case "zoom3":
layer1.ScaleTo(2,2,1,0,2,9);
break;

case "uptitle":
Titulo.Font.Size = Titulo.Font.Size +2;
break;

case "downtitle":
Titulo.Font.Size = Titulo.Font.Size -2;
break;


case "lowerout":
image4.ScaleTo(1,1,1,0,2,9);
image4.MoveTo(20,22,2,1,9);
image1.moveTo(-1280,0,2,0.5,6);
logo.moveTo(-310,0,2,0.5,9);
sleep (500);

break;

case "lowerin":
sleep(500);
logo.moveTo(-60,0,1,1,8);
sleep (400);
image1.moveTo(88,0,1,1,8);
sleep(500);
image4.ScaleTo(1.7,1.7,2,0,1,9);
image4.MoveTo(-140,22,1,1,9);

break;


default:
posi = MsgString.indexOf(";")
nom = MsgString.substring(0,posi)
// this "substring" is for send some part of the text to another place (to "title.text")
subnom = MsgString.substring(posi +1,MsgString.length)
text7.text = nom;
title.text = subnom;


break;
}
}


Top
 Profile  
 
PostPosted: October 10th, 2013, 1:25 pm 
Offline

Joined: June 18th, 2012, 12:07 am
Posts: 268
Quote:
but I want to send action msgs to the same widget

would this work for your actions by using if statements ?

function widgetOnMsg(MsgString) //Message code in the remote widget

if(MsgString=="close") // remote close, action 1
{
close(); //action 1
}
if(MsgString=="hide") // remote hide, action 2
{
widget.visible=false;
}
if(MsgString=="show") // remote show, action 3
{
widget.visible=true;
}


Top
 Profile  
 
PostPosted: October 10th, 2013, 8:22 pm 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
Armando wrote:
Ups!, thanks digigamer!!!... but since I'm not professional of codes... (just hobbyist)... I would not know how to do all that you suggest :(
that's the ugly part of being only "designer" :)

Well, I'm a professional! Next time, I'll see that I'll put some code. :mrgreen:

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group