Sigma Php Ajax framework, Ajax Components, GUI Builder
May 23, 2012, 09:17:44 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
Sigma Php Ajax framework, Ajax Components, GUI Builder
>
Sigma Visual GUI Builder & Library
>
Sigma Visual - Q&A
(Moderators:
steven
,
linb
) >
Create and destroy a dialog
Pages: [
1
]
« previous
next »
Print
Author
Topic: Create and destroy a dialog (Read 945 times)
gikotim
Sr. Member
Posts: 49
Create and destroy a dialog
«
on:
January 04, 2010, 02:18:46 PM »
I try to create a dialog when a button is pressed, and destroying the dialog with a button in the dialog.
I don't know why the event handler for closing the dialog isn't called.
Can you give me a hint?
Thank you very much for your support.
Here the sample code:
Class('App', 'linb.Com',{ Instance:{ autoDestroy:true, iniComponents:function(){ // [[code created by jsLinb UI Builder var host=this, children=[], append=function(child){children.push(child.get(0))}; append((new linb.UI.Button) .host(host,"button6") .setLeft(150) .setTop(180) .setCaption("Open Dialog") .onClick("_button6_onclick") ); return children; // ]]code created by jsLinb UI Builder }, events:{}, customAppend:function(parent,subId,left,top){ return false; }, iniResource:function(com, threadid){ }, iniExComs:function(com, hreadid){ }, _button7_onclick:function (profile, e, src, value) { this.dialog1.destroy() }, _button6_onclick:function (profile, e, src, value) { me = this; dialog1 = new linb.UI.Dialog({left:271, top:208, caption:"dialog1"}); dialog1.host(me,"dialog1"); dialog1.show(); me.dialog1.append((new linb.UI.Button) .host(dialog1,"button7") .setLeft(80) .setTop(110) .setCaption("Close Dialog") .onClick("_button7_onclick") ); me.dialog1.append((new linb.UI.Label) .host(dialog1,"label1") .setLeft(80) .setTop(60) .setCaption("I'm a Dialog") .setHAlign("center") ); } } });
Logged
linb
Administrator
Hero Member
Posts: 435
Re: Create and destroy a dialog
«
Reply #1 on:
January 04, 2010, 09:23:51 PM »
"button7" will find "_button7_onclick" from its "host". Here, you set host to "dialog1", but "_button7_onclick" is in the com.
Logged
gikotim
Sr. Member
Posts: 49
Re: Create and destroy a dialog
«
Reply #2 on:
January 04, 2010, 10:00:57 PM »
I see. How to change this?
I found a solution, but it's not so elegant:
me.dlg_login.append((new linb.UI.Button) .host(dlg,"button9") .setLeft(90) .setTop(100) .setCaption("$app.caption.login_ok_but") .onClick(function(){ me.label48.setCaption(dlg.input_login_user.getUIValue()); var tmp = "$app.caption.logout_but"; me.sbutton4.setCaption("$app.caption.logout_but"); dlg.destroy(); }) );
Which has lead me to my next problem: I try to change the caption of the button within the onClick-handler. It doesn't work with localisation!
It just shows: "$app.caption.logout_but" instead of the string from the localisation-file.
Can you help me?
Logged
linb
Administrator
Hero Member
Posts: 435
Re: Create and destroy a dialog
«
Reply #3 on:
January 05, 2010, 12:53:33 AM »
"$app.caption.login_ok_but" will try to get text from path "linb.Locale.en.app.caption.login_ok_but".
You can load a js file(in your html file or whatever other ways):
linb.Locale.en.app = {
caption:{
login_ok_but:"your caption"
}
};
Logged
gikotim
Sr. Member
Posts: 49
Re: Create and destroy a dialog
«
Reply #4 on:
January 06, 2010, 01:44:36 PM »
Please excuse me, I don't understand exactly what you mean.
Would you mind giving me an example of how to change the text of a label dynamically with the correct text out of a language file?
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News & Announcements
-----------------------------
Sigma Visual GUI Builder & Library
-----------------------------
=> Sigma Visual - Knowledge Share
=> Sigma Visual - Q&A
=> Bug Report & Wishlist
-----------------------------
Sigma Grid
-----------------------------
=> Sigma Grid - Q&A
=> Show Case
=> Bug Report & Wishlist
-----------------------------
Other
-----------------------------
=> AJAX & JavaScript
Loading...