HTML5 ui-controls pick up from canvas-1 and drag-and-drop onto cnvas-2 - drag-and-drop

I am very new to web based programming and have started with HTML5 from this week.
I have create a bunch of flow-chart diagrams on first canvas-1 programmatically by javascript and by using addflow (Lassange) HTML5 controls. Now I have another canvas-2 at its side on which I want the user to pick any given UI-control (from canvas-1) and drag-and-drop the same on canvas-2. BUT I am unable to achieve this.
I tried assigning draggable property to the programmatically created ui-control (canvas-1) and also made the canvas-1 draggable etc but I think this approach will not work. The UI-control does get dragged but ONLY within the boundaries of canvas-1. Now how do I ensure that an user can be able to do this... what should be my javascript coding approach at the html-page-behind?.
EDIT: Somebody who is acquainted with Lassalle's technologies -- 'AddFlow' HTML5 jscript component can be of more help here because I am using that HTML5 control to create two canvas and for filling the set of UI-controls as a 'pallet' into the canvas-1. But if somebody has achieved this through some native HTML5 javascripting or alike then still do reply.

Related

UIPageViewController/TextKit Multipage flow in SWIFT

Has anyone had any luck creating a multiple page view of document (one, NSTextStorage, one NSLayoutManager, and multiple NSTextContainers) in Swift. I'm having a lot of trouble finding example code not in objective C.
Basically, I'm trying to recreate the "Advanced Text Layouts and Effects with Text Kit" demo from WWDC 2013, but the whole thing is in Objective C and there is no sample code to be found. The post below seems to be having luck; but I'm having no luck translating...
UIPageViewController/TextKit Reflowing Text on paging
http://rshankar.com/quotes-app-simple-page-based-application-in-swift/
This uses the Page Based Application project template for a out-of-the-box working example, then customize for the model you want to use.
It use this same technique in my app by changing the root controller to what ever viewController I want it to be, coping the three files into my app, and all the magic is done for me.

Simple Ajax script for iphone?

How do you use an ajax script on an iPhone app?
I have a jquery script on my webpage that i would like to be on the view controller for my new app.
<jquery...code...>
Lets pretend the above is the jqueury code. How would i port this over to the iPhone view controller? Thanks sorry the question is so simple.
(all the code does is display a loading box that spins around and around and its quite pretty. Im probably going to put an image inside it )
Unless you're using a UIWebView in which case you simply embed a web page (including the JS code) into your app, jQuery (or rather Javascript and the DOM) is completely distinct from Objective-C and Cocoa Touch, so you can't use it, and the only option is to rewrite the same code in the new language and framework.

Positioning a sap.m.list

I'd like to create a twitter like stream out of a sap.m.list, hence when I get more data with a pulltorefresh control, I'd like to update the list with the additional rows, but should not move the list at all, and be hidden until the user scrolls the list down.
Any standard ways of doing this, or alternatively, custom CSS/JS recommended ways of doing this?
Thanks,
Matt
There's no need to drop down to jQuery here as OpenUI5 already contains the awesome iScroll library.
I've just setup a test app for you to have a look at here: https://github.com/js1972/ui5_pull_to_refresh.
Clone this; check the readme; then just run grunt serve to open the app in your default browser. You can use Chrome dev tools to emulate an iphone or android, etc.
I think this does what you're after - it works just like the GMail mobile app. You pull down to refresh items and at the end of the refresh your still looking at the same items but can now scroll up to see the new ones.
Will be interesting to see the performance if you have a thousand items... iScroll gives you allot of settings to play that may help (which aren't discussed in the UI5 SDK).
One thing to be careful of with browser scrolling is paint times. If the browser is not 100% done painting then iScroll can't calculate all the element dimensions it needs and you get strange results - typically just no scrolling. Sometimes you've just got to give a little time back to the browser by wrapping things in setTimeout(scroll_stuff, 0).
Hope this helps...
While not quite the answer I was after, looked into doing it another way, and provided you can work with automatically generated Id's that you'll need to calculate based on the row number, the following is one brute force way of doing it (I've borrowed it from another SO question and kept the animation for fun - Referenced SO Link):
var pOffset = $("#__item0-App--Main--MyList-76").position().top;
$("#App--Main--myPage-cont").animate({scrollTop: ( pOffset)}, 800);

onClick appears to work on all but my iphone

For some reason the following html doesnt work inside safari on iphone 4.
Test Link</div>
it works on safari inside a regular browser. I am using senchatouch2 framework.
Thanks
The only way you can add events to dom elements in Sencha touch 2.0 that I know of, is to use their element events api. this is an example of it. Alot of events are available like tap, double tap and so on.
var el = Ext.get("test");
el.addListener( 'tap', function(e){
alert('it works!');
});
This goes after the panel is rendered.
I propose that you do not use such inline event handlers.
Not only is it better to separate markup and behavior, but you should let sencha touch handle the messy business of unifying events across browsers.
At the very least give your tag an id and do Ext.get('id').on('tap', function(){...})
But still better look into MVC features to avoid such low-level code altogether.

How to keep NPAPI plugins alive in ExtJS tabbed views

I'm trying to use a custom video player NPAPI plugin (view FireBreath) inside an tabbed ExtJS application. The plugin lives in one tab, and the others contain presentations of other non-video data.
When switching from tab to tab, the element that contains the plugin is destroyed, and all plugin state is lost. Is there any way to configure an ExtJS tabbed panel so that the html contained in it is not altered when switching to another tab (just hidden)? The alternative is to re-populate the plugin state when returning to the tab, but this would be associated with an unacceptable delay (mostly while waiting for video key frames).
Thanks,
O
I don't know about your ExtJS approach, if you can solve it on that side that would of course be preferrable.
However, if you can't, you can avoid the reinitialization by moving the stream handling to a helper application that is running in the background. The plugin would launch it as needed and receive the stream data from it after registering for it.
The helper would be told when to kill a stream and possibly kill it by itself after some timeout (to avoid session leaks in case of crashing plugins etc.).
I was about to consider a helper application as recommended above, or look into rewriting the plugin to be windowless. Both might be more robust solutions for other JS frameworks.
Fortunately, the solution ended up being simpler than this, at least for ExtJS. By default, ExtJS sets "display: none" on the tabbed view's div whenever it is undisplayed, which calls the plugin destructor. After doing a little more looking through their enormous API, ExtJS has a parameter hideMode as part of the Ext.panel.Panel base class:
'display' : The Component will be hidden using the display: none style.
'visibility' : The Component will be hidden using the visibility: hidden style.
'offsets' : The Component will be hidden by absolutely positioning it out of the visible area of the document. This is useful when a hidden Component must maintain measurable dimensions. Hiding using display results in a Component having zero dimensions.
Defaults to: "display"
Setting the parent Panel that contains the plugin to hideMode: 'offsets' fixed the problem perfectly.