Waterfalls in QML JavaScript
I already use a lot of functions in my apps
now, I wanted to do some operations of strings as
Text.Substring (10, text.length)
but it does not work
What do I have to import something in my QML?
I was expecting that JavaScript standard library would be auto-magiquement inside the QML Cascades
If not: what is the best js file to include with standard and compatible features to Apache 2 license?
close this thread here is the discussion on this topic now
GOD
Tags: BlackBerry Developers
Similar Questions
-
QML Javascript escape character
I am trying to use a regular expression in javascript in a QML file function, as follows:
function parseAndHandleHyperlinks(inString) { result = inString.replace(\[.*\]\(.*\)/g, ""); return result; }
Each backslash is stressed and has the following error: "mismatched of entry"------"expected LF.
The backslashes are used to escape their characters, so I can match the literals [,], (en)
p.s. the function does nothing, just trying to make QML accept my regular expression at the present time.
That doesn't look like a regular expression valid in JavaScript. You're not missing a leader / (slash) to go with the final just before the 'g '?
-
Way to display the QML JavaScript dialog?
I was hoping that I could do something like:
Alert ("Here");
... from JavaScript QML.
Is there a way to bring up the debug dialog boxes?
I see that you can do:
Console.log ("Here");
... that mainly solves what I need. But I'm still curious.
-
Change GroupDataModel ItemGroup via QML / Javascript
Running in a smalll snag, which takes too much time to resolution... I'm putting the DataModel consolidation via a function of javascript QML.
function setDataModelGrouping(groupingTypeFull) { myDataModel.setGrouping(groupingTypeFull ? ItemGrouping.ByFullValue : ItemGrouping.ByFirstChar ) }
When this is executed, the following error is generated... Error: Unknown method parameter Type: bb::cascades:ItemGrouping:Type
So basically, my QML file has no idea what ItemGrouping... but in a GroupDataModel, ItemGrouping is accessible...
MyModel { id: myDataModel // Sort the data items sortingKeys: ["column1", "column1"] // Set sort order to descending sortedAscending: false // Specify that headers should reflect the full value // of the sorting key property grouping: ItemGrouping.ByFullValue ... }
Am I missing an import?
Thank you
Got, it works by creating a method of setMyDataModelGrouping within the myDataModel class. Not the best solution, but enough time spent on studying this issue...
I am still confused about why a method GroupDataModel.setGrouping () keep omitting of javascript... According to the literature, it is a public method... therefore justiciable qml / js.
-
Is there a way to use QDateTime and QDate with DateTimePicker in QML/Javascript function?
I use a DateTimePicker control to get the date/day of the week, etc., chosen by the user. Is there a right-postponed way to do this without using C++?
Sorry, I forgot to attach the code :-)
var dateSelected = datePicker.value; console.log("dateSelected=" + dateSelected); var daywwek = dateSelected.getDay(); console.log("dayWeek=" + daywwek);
-
How to debug javascript/qml?
is there a way to set breakpoints in qml/javascript and debugging code?
Normally I can SSH to my Nokia N9 will enable developer mode.
You should also be able to do it on the playbook:
http://openbbnews.WordPress.com/2011/12/21/devuser-and-1000/
And then edit files using vi (assuming that QNX vi?).
I have yet to try this with my playbook, but I'll do that when I start the porting on BB 10 soon.
-
Bridge between JavaScript in HTML &; qml
Hello
I am loading an HTML file in Web mode. I need to pass data of qml, JavaScript in the HTML file. Is it possible to create an interface between the JavaScript code & qml to Exchange data between them?
Thank you
Nishant Shah
Hello
I managed to find the solution. Just go to this link & you're done:
https://developer.BlackBerry.com/Cascades/reference/bb__cascades__webview.html
Sorry to bother you!
Kind regards
Nishant Shah
-
C++ or waterfalls or HTML5 for BB10
Hello world
I'm new to BB development and although I've done a few VB and some HTML work, I'm a little stuck on the direction to follow. The application I want to develop is a management with a decent amount of logic application business going on in the background. Given that I'm not developing a game that requires quick speed super treatment or a lot of custom screens, I thought using the system of Cascades. Am I wrong? Or should I be developing in C++ (which I'm not currently).
I also saw somewhere that there is a plugin for BB10 VB? It is a path suitable for follow - develop in VB that I already know?
C++
Cascades
VB
Any thoughts on the pro and cons of each approach would be appreciated.
Thank you
Paul
paul2020, it seems that the approach of WebWorks can work best for you, at least to start with. It allows you to manage the BB Phone with much the same code base.
If you structure the code itself, with a logic that is strictly separated from the interface user, then you can migrate to waterfalls with QML to the user interface and possibly with some of this intact preserved Javascript code.
For the size of the app, I'm not sure you need to do a lot on the C++ front initially, so you could defer this until a later date learning curve. Given how otherwise there is so much to learn here, maybe it's better.
-
Add a dynamic control to scrollView in QML
How can I add a container (random) ScrollView number. QML, javascript function cannot init a QML inside object. ? Please answer
You need ComponentDefinition
attachedObjects: [ ComponentDefinition { id: itemDefinition MenuItem { id: item } } ]
And inserted dynamically
var tmpList = Array(); for (var i = 0; i < 8; i ++) { var tmp = itemDefinition.createObject(); tmpList.push(tmp); tmpList[i].itemLabelText = (i + 1).toString(); tmpList[i].translationX = getPositionX(i); tmpList[i].translationY = getPositionY(i); menuContainer.add(tmpList[i]); } itemsList = tmpList;
Example above maintains the reference to each item in the list, so that you can edit them after. Here is a complete project: http://www.darkenergy.si/circular-menu/
-
onCreationCompleted shipped before import JavaScript is over
Hello
I have a very small QML that matters a little JavaScript (128 lines) file that matters in turn another small JavaScript file (80 lines). In summary QML--> JS A--> JS B. In the JS files are essentially class definitions, and some small global code running. JS files have zero dependencies of the QML.
The problem is that when the rootComponent.onCreationCompleted signal is distributed on the QML, JavaScript dependencies are not ready yet.
I get a lot of erros as:
asset:///Test.qml:10: TypeError: Result of expression 'ONA.inst' [undefined] is not an object.
I also use the reminder of the Qt.include, Qt.include ("b.js", function() {}), a.js wait b.js be fully charged to a.js.
I expect the onCreationCompleted signal of the element root to be shipped after all imports of JavaScript and its dependencies, where it is fully charged.
I use BlackBerry10Simulator-BB10_2_1-3502 with VM Ware Fusion 7, under Mac OS X 10.10.3. Unfortunately I have not access to any real device.
Please advice.
You can try RenderFence, add this code to your object of root (TabbedPane, Page or NavigationPane) instead of onCreationCompleted:
attachedObjects: [ RenderFence { raised: true onReached: { \\ your code goes here } } ]
-
Appeal to the segment of javascript control
Hi try to remove an Option from a Segment control in QML file using Javascript, but can't seem to get the correct argument.
Anyone have an example of what I have tried the search for several hours now and no examples.
The call, I'm trying to make is:
segControl.remove (segControl.optionSchedule);
where optionSchedule is the id of the control of the Segment "Option" element
Other functions work, but it happens with the error;
TypeError: Result of expression 'segControl.remove' [undefined] is not a function
Did I miss a typecast or if this function is not supported?
Hello
Unfortunately remove() cannot be called since QML/JavaScript because it isn't Q_INVOKABLE, so you don't have to call from C++ instead.
I would like to know if there is anything else I can do for you.
See you soon,.
Daniel
-
Question very, very based on QML...
I'm new to BB10 development and I have read on the provided tutorials and reference materials. As the title of my post, I have a very basic question for QML who may have a not so fundamental response:
Just what exaclty QML can be used for? Literature in the documentation seems to suggest in places that QML is used for user interface elements scripts, while behind the scenes is done by code written in C++. Other documentation seems to hint that an application can be written in QML although the only examples I've seen of this apps that really only window UI elements.
I guess that a shorter question would be: can I write a useful application entirely in QML without ever touching the C/C++?
On a related note, when someone says that they wrote the app in "cascades", what are they referring to? Is the sequel to stunt development? It is referring to the use of QML / C + c++ / QT?
You can think of as an extension of Qt which allows a more sophisticated user interface specially design for phones BB10 Cascades.
QML we can consider, at its simplest, as a way to describe how you want to place controls on the screen.
Where it gets complicated is the ability to use JavaScript in the QML himself file.
So yes, it is possible to write completely competent applications entirely in QML/JavaScript and do not write any C++.
A good starting point is the free to download the book of development...
-
How get the number of items in the ListView inside QML?
QML/JavaScript newbe question here please.
Suppose I have .qml
import bb.cascades 1.0 NavigationPane { id: navigationPane Page { ... Container { ... ListView { id: listviewPlayers ...
and I want to do something if ListView does contain all of the elements
onCreationCompleted: { // this slot is called when declarative scene is created if (listviewPlayers.AllItems.count() == 0){ // do something; }
but when I run the present I get complain AllItems is not defined in this line:
if (listviewPlayers.AllItems.count() == 0){
What I doing wron? I can do the same thing in C++ without any problem.
Thank you.
Oh, this thing AllItems seems to be a 'Sentinel' or a magic value used in special cases, unrelated to this.
I think that ListView manages all this, but defers everything to do with the pieces of data to the model, you don't have to go to the model for the data. ListView knows how VisualNodes (the components list item) he created at the time of the display on the screen, but also have to tell you the total number of elements in the model would simply duplicate work. (The reasoning behind this interpretant.)
-
When an open one hour file the first qml I have a popup of warning telling me that I have the QML preview is unaivalable. It's ok since I still have the QML editor with syntax coloring, etc...
But the second time I open a file QML, the freezing of the IDE, and I have to kill him.
First below error log:
eclipse.buildId=10.0.9 java.version=1.6.0_24 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_FR Command-line arguments: -os win32 -ws win32 -arch x86 Error Thu Nov 29 11:53:10 CET 2012 Plug-in 'com.rim.tad.tools.qml.javascript.debug.internal.ui' contributed an invalid Menu Extension (Group: 'jsdebug' is invalid): com.rim.tad.tools.wst.jsdt.debug.ui.jsunit.popup.evaluate
The error is different, but the resolution is the same:
http://supportforums.BlackBerry.com/T5/Cascades-development/Beta4-cannot-preview-QML/TD-p/2009593
-
Device-Release don't build no good?
I had a BB app world since March, which passed through numerous published versions 10.0.0 to 1.4.2. I've never had a problem of construction for immediate release. I am currently in the middle of a complete rewrite, spending most of the logic in C++ QML/JavaScript. With this new version that I can build for Simulator-Debug and it works fine on the Simulator. Similarly, I can build for the device debugging and run it on my Z10 with a token of debugging. The problem is when I Isaiah to compile to release device. The log shows the build completed without errors, but when I try to deploy my Z10 to test the IDE says that the file does not exist. When I click on the Details button it shows the way to the so-called missing program file, but when I check the file exists.
I tried to clean and rebuild the project, as well as construction and by deploying with Momentics 10.1 and 10.2, but they will not just load the compiled on my Z10 version or they will create a BAR file. I spent almost a month completely rewrite my application and I would not lose my job because the IDE won't let me out. The Momentics 10.1 and 10.2 runs the new app in the Simulator and on the Z10 if I build in debug mode, but not in release mode.
What gives?
EDIT: I realized after I posted that the file he is looking for is NOT here, under a slightly different name is instead. See my solution below for more details.
Answered my own question.
Found a trick here and realized that I had missed the things when I started the new version. I wanted the new app to have the same name as the old one, but necessary to keep it in a new project directory. After that I created the new project, I edited the app.pro file and the files of handle bar to change the name of the application of the finite. It works fine until you wan't do a Release, time at which Momentics generates an executable with the wrong name.
Maybe you are looking for
-
Calendar freezes. The most appropriate is transferred to the server. Never finishes... El Capatain, last updated
-
HP 110-210 desktop: HP 110-210 - is two monitors supported with this model?
Hi all I was looking at to the top of the plug the graphics card, I have to this desktop computer, and it seems that both monitors are not supported. Can anyone confirm if this should be supported. Integrated graphics card is ATI Radeon 8330. I curre
-
Windows Server 2008: Corrupted system files
On a Windows Server 2008 R2: SFC/scannow fails to 58% with "corrupt files unable to fix some". Subsequent DISM / Online/Cleanup-Image /RestoreHealth Error 3: C:\Windows doesn't seem to be a valid directory.
-
I have an error of comms EOS 24-105mm
I have a 24-105, attached to a 5 d Mk III EOS and get an error message: 'Err 01 communication between the athd goal is defective. Clean the contacts of the lens. "This happens when you try to shoot at any focal length except wide open. If you try to
-
The sound coming from headphones and speaker
HI all my laptop play sound from the speaker and headphone and I want only helmet I tried to install latest Version of the driver, but does not OS: Win 7 Sound card: Srs Premium Sound Best regards