How to call javascript in an another QML
Hello
I have 2 file QML file qml 1A listview with ArrayDataModel as the source of data, when the user clicks on a line, it nav push another QML to change/remove, the arrayDataModel consist of a given amount of time, which 1 contains a qml file label to display the subtotal of all time values in the data model. I also have a javascript that will do a loop through the ArrayDataModel to update the label of the total time that I call the file onCreationCompleted 1 qml, all works well.
However, when deleted, the listview will automatically update, now the problem is how can I trigger a refresh on qml file 1 in order to update this label.
Here's the qml file 1
import bb.cascades 1.0 NavigationPane { id: navigationPane backButtonsVisible: false Page { titleBar: TitleBar { title: "Interval Timer" } content: Container { id: root background: Color.LightGray // Javascript definition function udpateTotalTimeLabel() { var totalHour = 0, totalMinute = 0, totalSecond = 0; var print = function(o) { var str = ''; for (var p in o) { if (typeof o[p] == 'string') { str += p + ': ' + o[p] + '; '; } else { str += p + ': { ' + print(o[p]) + '}'; } } return str; } for (var i = 0; i < eventsModel.size(); i ++) { var currentEvent = eventsModel.data([ i ]); totalHour += parseInt(currentEvent["EventHour"]); totalMinute += parseInt(currentEvent["EventMinute"]); totalSecond += parseInt(currentEvent["EventSecond"]); } if (totalHour < 10) totalHour = "0"+ totalHour; if (totalMinute < 10) totalMinute = "0" + totalMinute; if (totalSecond < 10) totalSecond = "0" + totalSecond; totalTimeLabel.text = totalHour + ":" + totalMinute + ":" + totalSecond; } ... Container { // Container for the total time id: digitsContainer preferredWidth: 780.0 background: Color.create(0.2, 0.2, 0.2) bottomPadding: 50.0 layout: DockLayout { } verticalAlignment: VerticalAlignment.Center horizontalAlignment: HorizontalAlignment.Center topPadding: 50.0 topMargin: 0.0 Label { id: totalTimeLabel horizontalAlignment: HorizontalAlignment.Center text: "88 : 88" textStyle.fontSizeValue: 0.0 textStyle.lineHeight: 1.5 textStyle.textAlign: TextAlign.Center topMargin: 0.0 verticalAlignment: VerticalAlignment.Center // Apply a text style to create large, light gray text textStyle { base: SystemDefaults.TextStyles.BigText color: Color.Green } } // end of total time container } Container { // Conatiner for the Go button id: goButtonContainer layout: StackLayout { ..... onCreationCompleted: { root.udpateTotalTimeLabel(); console.log("No of EventsModel: " + eventsModel.size()); console.log("In sheet creationCompleted"); mainObj.dataReady.connect(root.onDataReady); }
Here's the qml file 2
import bb.cascades 1.0 import bb.system 1.0 Page { titleBar: TitleBar { title: "Edit Event Detail" } property alias txtEventName: eventNameText property alias pickEventTime: eventTimePicker property int selectedIndex: 0 // Javascript implementation content: Container { id: editEventPage Container { layout: StackLayout { orientation: LayoutOrientation.TopToBottom } Container { Container { layout: StackLayout { orientation: LayoutOrientation.LeftToRight } leftPadding: 20.0 topPadding: 50.0 bottomPadding: 50.0 Label { text: "Event Name" preferredWidth: 200.0 } TextField { id: eventNameText hintText: "Enter Event Name" preferredWidth: 500.0 } } Container { layout: StackLayout { orientation: LayoutOrientation.LeftToRight } leftPadding: 20.0 Label { text: "Event Time" preferredWidth: 200.0 } DateTimePicker { id: eventTimePicker mode: DateTimePickerMode.Timer minuteInterval: 1 preferredWidth: 500.0 onValueChanged: { } } } } } } // Attached Objects attachedObjects: [ SystemDialog { id: dialogConfirmDelete title: "Confirm Delete" body: "Do you really want to delete this event?" onFinished: { if (dialogConfirmDelete.result == SystemUiResult.ConfirmButtonSelection) { console.log("Commiting to delete " + selectedIndex); eventsModel.removeAt(selectedIndex); navigationPane.pop(); } else { return; } } } ] // Context actions actions: [ ActionItem { title: "Save" ActionBar.placement:ActionBarPlacement.OnBar onTriggered: { } }, ActionItem { title: "Delete" ActionBar.placement:ActionBarPlacement.OnBar onTriggered: { dialogConfirmDelete.show(); } }, ActionItem { title: "Cancel" ActionBar.placement: ActionBarPlacement.OnBar onTriggered: { navigationPane.pop(); } } ] }
Thanks in advance
NVMD, I solved it.
QML 2 file-> refresh C++ function signal-> qml file 1 onDataReady call javascript to label fresh
Tags: BlackBerry Developers
Similar Questions
-
How to call a function in another function?
When I press a button, I want a series of functions to be performed one after the other (they contain interpolations, but its not relevant) , all of them waiting for the previous must be filled. I want to put the series of functions within a function, so I can simply call this function to run all others. Animations work well, but I don't know how to call functions of in another function. It would also be necessary each function to wait until the previous one is complete, to run. This is a clear example of what I need to do:
boton.onPress = animate;
Function animate () {}
Animation1 (onComplete: animation2);
animation2 (onComplete: animation3);
animation3;
}
Function () {Tween 1} animation1;
Function () {Tween 2} animation2.
Function animation3 () {Tween 3};
any suggestions?
which isn't really make sense unless you're tweening or do something of asynchronous (such as loading a file).
Function b (): Void {}
C() ;
D() ; C() executed when this line runs
}
-
How to call a bunch of another instance?
Hi all:
How to call a bunch of another instance?
for example:
package A is for instance A1
Package B belongs to instance B1
Now, I want to call package B A1 pending, how can I do? my environment is oracle 10g
Concerning
TerryIf the instance A1 and B1 instance is not in the same machine, can I use the same db link to connect?
YES
-
How could call a report from another report?
Dear developers,
How could call a report from another report?
is this possible? and what is the call statement?
Note: I use the 6i report
Thanks in advance,
BilHello
It seems that you 'open' a quote before: orderby.
You must "close" this quote after: orderbySRW.run_report ("report = SDCRVRF106 Cl_NO ='|"'|: CLIENT_no | "") ' || ' d1='||'''' || :D1 ||'''' ||' d2='||''''||:D 2 ||'' ' |' orderby =' | '''|| : o rderby | " ') ;
concerning
-
How to call a function in c ++ QML?
Hi all
In my application, I saw two QML and a class of CPP.
Saying one of my root qml: main.qml is a root page, which displays a list. And the line of the list is an another qml (Customrowlist). And I put the contextProperty for main.qml in the PRC and I need to call a function in the PPC of
Customrowlist.QML.
I want to call the deleteAccountData(..,..,..) function. Customrowlist.qml, so how can I do.
Here is my code
hand. QML
TabbedPane { //property Page about id: tabbedPane showTabsOnActionBar: true Tab { title: "Manage Accounts" onTriggered: { objectAM.fetchAccountData(); } imageSource: "asset:///images/list.png" NavigationPane { id: navPane Page { Container { background: back.imagePaint layout: StackLayout { } ImageView { imageSource: "asset:///images/head.png" scalingMethod: ScalingMethod.AspectFit opacity: 1.0 } ListView { id:savedaccount objectName: "savedaccount" listItemComponents: [ ListItemComponent { type: "item" CustomListRow { } } ] } } actions: [ ActionItem { id: about title: "About" imageSource: "asset:///images/info.png" ActionBar.placement: ActionBarPlacement.InOverflow attachedObjects: [ ComponentDefinition { id: aboutPageMA source: "about.qml" } ] onTriggered: { var profilePage = aboutPageMA.createObject(); navPane.push(profilePage); } }, ActionItem { id: help title: "Help" imageSource: "asset:///images/help.png" ActionBar.placement: ActionBarPlacement.InOverflow attachedObjects: [ ComponentDefinition { id: helpPageMA source: "Help.qml" } ] onTriggered: { var profilePage = helpPageMA.createObject(); navPane.push(profilePage); } }, ActionItem { id: settings title: "Settings" imageSource: "asset:///images/settings.png" ActionBar.placement: ActionBarPlacement.InOverflow attachedObjects: [ ComponentDefinition { id: settingsPageMA source: "Settings.qml" } ] onTriggered: { var profilePage = settingsPageMA.createObject(); navPane.push(profilePage); } } ] } } } attachedObjects: [ GroupDataModel { id: feedsDataModel sortingKeys: ["text"] sortedAscending: false grouping: ItemGrouping.None }, DataSource { id: feedsDataSource source: "mydata.json" type: DataSource.Json onDataLoaded: { feedsDataModel.clear(); feedsDataModel.insertList(data); } onError: { console.log("Error Occured" + errorMessage); } }, ImagePaintDefinition { id: back repeatPattern: RepeatPattern.XY imageSource: "asset:///images/bg.jpg" } ] }
My Customlistrow.qml
import bb.system 1.0 import bb.cascades 1.0 import bb.data 1.0 Container { layout: AbsoluteLayout {} Container{ id: usr layoutProperties: AbsoluteLayoutProperties { positionX: 0.0 positionY: 0.0 } background: Color.create ("#ffffff") preferredWidth: 768 preferredHeight:120 Container{ layout: AbsoluteLayout {} ImageView { id:accountimg imageSource: ListItemData.account preferredWidth: 78 opacity: 1.0 layoutProperties: AbsoluteLayoutProperties { positionX: 10.0 positionY: 16.0 } } Label { id: username text: ListItemData.username textStyle.base: SystemDefaults.TextStyles.TitleText multiline: true textStyle.color: Color.Black textStyle.textAlign: TextAlign.Left layoutProperties: AbsoluteLayoutProperties { positionX: 110.0 positionY: 25.0 } } ImageButton { defaultImageSource: "asset:///images/delete.png" pressedImageSource: "asset:///images/deletepressed.png" preferredWidth: 78 opacity: 1.0 layoutProperties: AbsoluteLayoutProperties { positionX: 680.0 positionY: 16.0 } attachedObjects: [ SystemToast { id: myQmlToast body: username.text } ] onClicked: { myQmlToast.show() objectAM.deleteAccountData(username.text,password.text,"asset:///images/twitter.png"); } } Divider { layoutProperties: AbsoluteLayoutProperties { positionX: 0.0 positionY: 118.0 } } } gestureHandlers: [ LongPressHandler { onLongPressed: { id:finalx.play(); secondcontainer.visible = true; } } ] onTouch: { if (event.isUp ()){ initialx.play(); secondcontainer.visible = false; } } animations: [ FadeTransition { id:finalx toOpacity: 0 duration: 300 }, FadeTransition { id:initialx toOpacity: 1 duration: 300 } ] } }
in my PPC
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("objectAM",this); void AccountManager::deleteAccountData(QString user,QString pass,QString imgSource){ SystemToast *toast = new SystemToast(); toast->setBody("Entered delete account!!!"); toast->show(); }
I got your problem. Your CustomListrow does not receive the reference to your context "objectAM".
Please update your main.qml with the following... function and store the reference to the global object and then from your call of customListRow as "Qt.objectAM.deleteAccount ();
In the hand. QML on finished creation
onCreationCompleted: {}
Qt.objectAM = objectAM;
}In CustomListRow...
onClicked: {}
myQmlToast.show)
objectAM.deleteAccountData (username.text, password.text, "asset:///images/twitter.png");
Qt.objectAM.deleteAccountData ("Me", "pwd", "asset:///images/twitter.png");
}Hope it will work.
Thank you
-
How to call javascript process?
Hello!
I have a button Delete which redirects to url:
javascript:apex.confirm (htmldb_delete_message,'DELETE_CONFIRM_MSG');
And a process that is placed after validation.
How to call this process, I put the button to zero State and condition the type of request = Expression 1 and tried the two doDelete and confirmDelete in the expression field, but it does not work.
How can I call the process?
Hi EgaSega,
Give you an example, try something like below
(1) change your page
Create the javascript function in the HTML header
(2) of the button calls the javascript function
action button: "URL redirect".
Target URL: javascript:f_execProc();
(3) modify your process
In Conditions
When you press the button: no condition button
Condition type: request = Expression1
Expression1: REMOVE
Hope this helps you,
Kind regards
Jitendra
-
How to call a dll from another dll functions
Hi, can someone please tell me some examples or instructions on how you go about calling functions from a dll from another dll including the IUR. The two DLLs were created with labwindows cvi.
Thank you!
Hi Sinnas,
You mention that you use a UIR. A DLL does not have a file UIR as part of it.
DLL1
Instead, when you build the DLL first, we'll call it DLL1, you create a header or the files that contain functions that you want to the client code to call. When you build DLL1, you must export the file DLL1 function for his client to call code header. Whatever the calling code is (a GUI or another DLL), you must include in the exported DLL1 project headers AND DLL1 .lib file generated when you generate it.
DLL2
DLL2 will contain in its project, the header file exported for DLL1, DLL1 .lib file - that gives it the feature in DLL1. The code can then call any desired DLL1, but as DLL1, you should now have a header file that exports the functions of DLL2 desired HIS client code to call. When you build DLL2, you create a .lib for THAT DLL file to include in the code of the final customer.
GUI
The final customer code will be a few GUI that you create to call DLL2 functions will have the UIR upper layer file. It will include the exported DLL2 header file and the file .lib DLL2 in his project. It can then call any function of DLL2. It is the most clean way to have 2 dll working together.
NOTE: You can create a GUI to test the lower level DLL1 functions before placing DLL2 in the system. In fact, it's a good idea to do it - you want to make sure your lower level DLL1 code works properly before construction above it.
Simple diagram
Client code (calls to functions of the DLL2 header files) exported
--------------------------------------------------------------------------
DLL2 (DLL1 function calls exported in header files)
--------------------------------------------------------------------------
DLL1<-------------------- you="" can="" also="" create="" a="" gui="" that="" only="" calls="" dll1="" exported="" header="" files="" to="" test="" out="">-------------------- >
A suggestion... I create my dll in debug mode and use them to test my code. But I also build as static libraries. When I do the final version of the system, I use static libraries. They are built with the final executable and don't require additional files to install as do the dll. When you install your system with DLLs, you must include all THE dll and they must be installed in the folder Windows/System32 of the target computer.
I hope this helps...
Judy
-
How to call the paint of another method program
Hello
I have a custom BitmapField that I would like to drawText, using graphics.drawText. Previously, I had no problem, that I would call setBitmap to the paint method and it would make the drawText. However, he did an infinite loop problem, so I moved it to another function, that will affect the value manually the bmp. Now, I am unable to drawText, that I placed this code in my service object. I would, however, when I select this particular BitmapField to drawText.
For now, since another function setBitmap is not a very good option because this will call the FieldManager sublayout which I think can be a battery problem. Is there another way I can call drawText?
What is the reason, once again, to not draw the text from inside her object? Why must you to setBitmap() to draw the text in the first place?
Indeed, setBitmap() inside of object causes an infinite loop (I remember this post). However, it should not be linked to draw text in any way, nature or form.
Check some (members) variable inside your method object and make the draw you need based on this value. If you want your bitmapField to draw text under certain conditions, change the value of this member and invalidate(), causing object pick up the change.
In addition, if your FieldManager sublayout a problem, there are a problem. Look at this code and fix the bugs rather than them with all kinds of mobile code around masking.
If you need more assistance, please post here the pieces of code (especially how you would draw the text when it worked) and we'll figure out something.
-
How to call javascript method action listener.
Hi Experts ADF,
JDEV version 11.1.1.7.0
I cb2 and cb1 button, 2. I call the pressing cb1, cb1 - actionListener () method. I invoke the javascript cb1() method.
And JavaScript, I need to invoke the command button 2 actionListener. How do I get there?
I tried the below code but its not invoking is not the cb2_actionListener.
var button
= AdfPage.PAGE.findComponentByAbsoluteId ("cb2");
ActionEvent.queue (button, true);Thanks in advance,
Animesh
HI Anne
If you have created actionListener for button cb1 cb2 actionListener call you in this
See - Blog of Ashish Awasthi (Jdev/ADF): call to Action button by programming, Queuing ActionEvent
Or if you insist on using Javascript then try this
var component = AdfPage.PAGE.findComponentByAbsoluteId (commanButtonId);
AdfActionEvent.queue (component, component.getPartialSubmit ());
Thank you
-
How to call the SWF in another swf file using xml
HII,
I am facing a problem to call a SWF via xml when the loaded xml file it asks another swf file that includes a new xml file. now, if I call this nested swf calling without xml it works but in case of xml, it does not show the result. I confused Mr. how to nested xml file call done in as2/as3. I need some logic. Thanks in advance
This is the forum of AS3 and your assignment involves AS2 code. You should repost in the AS2 forum...
http://forums.Adobe.com/community/Flash/flash_actionscript
Aside from that, your problem may lie in the following lines...
_root.createEmptyMovieClip ("sub_container1", 1);
loadMovie (. attributes.url sub_SWFPath [1], "sub_container1");You create the new movieclip, sub_container1, in the _root, but you do not assign the loadMovie to load in the same movieclip (unless you have a _lockroot = true in your sub - swf). In all cases, you should repost in the AS2 forum to continue troubleshooting.
-
How to call a project to another project?
I have two different projects, one of which takes place in the individual project. At some point, I need to call the project on the other. But its showing the error message next message, whenever I tried to create the object for the other UiApplication object:
"application already running in this process"
Is it possible to invoke a the other UiApplication UiApplication? Or should he call us only the screen contained in another application?
You can launch another application using ApplicationManager.
If the application is already running, you can communicate with it using world events or a synchronization object in the runtime store. -
How to call JavaScript/ExtendScript for first Pro CC Mac OS
Looking for a way to run JavaScript aka ExtendScript in first Pro CC
Here's what I have for other applications Adobe, using AppleScript:
tell application "Adobe After Effects CC 2015" activate set SomeExtendScript to "ThisVariable='Runs This Js Code';" DoScript SomeExtendScript end tell tell application "Adobe Photoshop CC 2015.5" activate set SomeExtendScript to "ThisVariable='Runs This Js Code';" do javascript SomeExtendScript end tell tell application "Adobe Illustrator" activate set SomeExtendScript to "ThisVariable='Runs This Js Code';" do javascript SomeExtendScript end tell
But so far nothing for first.
tell application "Adobe Premiere Pro CC 2015" activate set SomeExtendScript to "ThisVariable='Runs This Js Code';" -- Does not work: DoScript SomeExtendScript -- Does not work: do javascript SomeExtendScript -- Does not work: do script SomeExtendScript end tell
ExtendScript = JavaScript Adobe-flavored. Very similar.
For other products Adobe AppleScript has been the key to do this.
Yes, but there is no need to limit your solution to a single platform!
I'd be curious to see what you do in AE.
Instead of trigger ExtendScript some system based on external data, you can put the buttons in a panel of HTML5 (JavaScript based) for convenience of the user.
Here is an example of PProPanel; other samples in the repository prettier HTML and use modern web frameworks; PProPanel is quite comprehensive in the use of agency ExtendScript API:
Samples/PProPanel to master · Adobe-CEP/Samples · GitHub
Pushing metadata to projectItems PProPanel = shows how to get the static value (metadata Panel) and temporal metadata (marker).Here is "how to set up a panel dev environment:
Samples/ReadMe.md to master · Adobe-CEP/Samples · GitHub
Work in the readme file, play with the sample and feel free to ask me anything!
-
How to call javaScript action af:commandButton
Hello
..... I use JDeveloper 11 g last Relese Version...
I have a commandButton control in my page as:
< af:commandButton text = "commandButton 1" id = "cb1" action = "gotoPage2" / >
I want to call this action of commandButton control when I press F8.
Thank you
Sameh NassarHello
Try
function invokeCommandAction(id){ var component = AdfPage.PAGE.findComponentByAbsoluteId(id); AdfActionEvent.queue(component, component.getPartialSubmit()); }
where 'id' argument, that you pass to this function is the id of the command button
Frank
-
How to call one process of another?
Hello
I created two process and two buttons on a page.
Button1 runs termpol1.
Button2 runs Process2, which is supposed to run termpol1 before execution of its own logic.
How can I implement this?
Thank you
GaborMake sure that Process1 has a sequence number less than Process2, then do the condition for the execution of termpol1 PL/SQL Expression with
:REQUEST in ('Button1', 'Button2')
in the Expression 1. Note that this condition is case sensitive.
-
How to call a function from another script.
Hallo
TypeError: Error #1009: cannot access a property or method of a null object reference.
next / NEXT)and here is my script.
Main.As
package
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.URLLoader;
SerializableAttribute public class Main extends MovieClip
{
public void Main()
{
trace ("Startup");
}public void PRINT (): void
{trace ('work');
}
}
}
Next.Aspackage
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.URLLoader;
SerializableAttribute public class then extends MovieClip
{private var _main:Main;
public function Next()
{
NEXT_INT();
}
private void NEXT_INT (): void
{mc.buttonMode = true;
mc.addEventListener (MouseEvent.MOUSE_DOWN, NEXT_PRINT, false, 0, true);
}private void NEXT_PRINT(e:MouseEvent):void
{
_main. PRINT();
}}
}
http://noLabel.pl/QuickTest.rar
http://noLabel.pl/QuickTest.zip
Try this. I can't compile your application in case of location (names of variables with national characters). Here you have a quick example: we have two symbols in the library buttonMC and playerMC related to clssses Player and button. There handleClick (click event handler) method in the Button class, who do the work for you.
concerning
JK
Maybe you are looking for
-
I have a satellite x 200-219 I just want to know if this memory is compatible
I have a computer laptop x 200-219 satellite I just want to know if this memory is compatible with the current memory and laptop I have the memory of the laptop at the moment is HYNIX DDR 2 PC 5300 HYUNDAI part number HYMP512S64CP8-Y5. The memory I c
-
How do I get the IMEI for my new IPad, so can I subscribe to the wireless service?
-
M200 & Multidock II the external display orientaion is upside in tablet mode
With the Portege M200 and II Mutidock I wanted to log in and use an external monitor, so I could use the M200 to draw/write on Tablet mode everything glancing outside, but little matter I try in screen orientation, one of the screens is backwards is
-
How can I get rid of the Norton Firewall after removing the antivirus?
Original title: Norton is uninstalled. How can I get rid of its firewall? I cancelled Norton a year ago. Wen I go to Microsoft Fixit and run the troubleshooter Windows Firewall, it's not nbeing able to 'fix' because some other firewall crashes my Win
-
One offers a solution to my problem of Vista Home Premium that prevents me to access my Microsoft Web Cam (also "glik' won't let me upload files.). Thank you very much in anticipation. Tony