RE:Create a button which when pressed it replaces an existing object on the screen to another object in Smartface App Studio? - smartface.io

After seeing #catherinelagoon's post I also having difficulty in quite understand how to replace an object using a button so is it possible to create a button which when pressed it replaces an existing object on the screen to another object in Smartface App Studio?
I tried using the answer provided in the post however I couldn't understand it much due to I'm a beginner in using Smartface App Studio and coding itself.
Thankyou and sorry for any inconvienience

After you create an image you should add it to a Page so it can show on that page. So here is a simple code for creating and showing an image on the page.
var image = new SMF.UI.Image({
visible: false
});
Pages.Page1.add(image);
function Page1_TextButton1_OnPressed(e) {
image.visible = true;
}

Related

How to tap to copy html text in flutter app

My developer is building an educational app for me and we kind of have a problem. I want to know how to tap a word or phrase on the screen to show copy, highlight, web search like the image below. The app was built with flutter and the code is in dart. This feature is really needed. Will appreciate if someone can help with a plugin or just a way to do this.
If you are using webview package you have a gestureRecognizers property in webview widget, just add this line:
WebViewPlus(
gestureRecognizers: {}..add(Factory<LongPressGestureRecognizer>(() =>
LongPressGestureRecognizer())),...)
Flutter has selectable text for that
If he is using webview, maybe this could help?
How to enable text selection modal(copy/paste/select) in flutter webview?
They is a package for copy and paste text in the flutter.
FlutterClipboard.copy(item.code).then((value) {})
package link
Well I got your problem.
There is a possible solution. Here you are doing is sending data from server in html format and displayed it using html_viwer. But there is no functionality I found to select and copy so far.
The possible solution is send string data from server and use SelectableText() to show the text and you will be able to select and copy your text.
There's a solution for this, just use SelectableHtml widget instead of only Html

Xcode Swift 5 MacOs app empty window when archived but works when running it from Xcode

I am building an app for Mac which logs into a website based on login and password collected from textfield and secure text field, then app opens an url which is created in my app based on date range selection with use of two date picker cell calendars. Next app displays html data in webWiev (using WKWebView), converts html to string using extension NSAttributedString and then saves retrieved data as txt file. Everything works as expected as long as app is run from Xcode "play" button. Problem is if I archive this app and launch it, it will bring up an empty window without any button, calendar or textfield. There are no errors, no crash logs on organizer, nothing.
I decided to perform a little test. I build another view controller with only one button which upon clicking will show my app main view controller. After archiving this modified app and running it outside of Xcode a window shows view controller with one button which is correct. But after clicking it nothing happens. App works great if running "inside" Xcode, a pushbutton shows main ViewController correctly. Do You have any clue what can be wrong? thank You!
Edit 1. So I found a discussion on apple which mention this problem. It is associated with IB WKWebView and problem is already known since some time. Now I have to get around the problem. Apple forum link: https://forums.developer.apple.com/thread/116047
Did you embed WebKit.framework to your app?
After comment that I wrote, I founded a solution and solved with this method.
Please check it out.

Change backgroundImage of right Nav button in Titanium - iPhone

I am developing an iPhone app using Titanium Alloy.
My problem is that I would like to change the backgroundImage of rightNav button.
I am using the rightNav button as a Filter button. My Filter button is placed in a window which also has a table. Once the filter button is clicked a new window is opened where the user can make some selections. Once the selection is made, the table on the previous page is refreshed based on the selections made and I would like to change the backgroundImage of the rightNav button to show that some selections have been applied. But I am unable to do so.
My code :
if ((screenType === "parentWindow") {
$.rightNav.visible = true;
$.rightNav.backgroundImage = "/images/buttons/filterOff.png";
} else if ((screenType === "childWindow")) {
$.rightNav.visible = true;
$.rightNav.backgroundImage = "/images/buttons/filterOn.png";
}
The backgroundImage of the rightNav button is set first time and then it is not changed. I have tried to make it null and then set it again but it does not work.
Please help.
Other details :
Titanium Command-Line Interface, CLI version 4.0.0, Titanium SDK version 4.0.0.RC, Mac OS X 10.10
Thanks
Try using the image property .

google chrome app script ask to save as userAppPanel

I encounter a problem using UIApplication in google app script, but only on Chrome 18.0.1025.142 m, my application works fine on Firefox 3.6, and also on chrome 16.x.x.
I updated my chrome version to 19.0.1084.56 m. And the problem still occurs.
On Chrome 18.0.1025.142 m and 19.0.1084.56 m, I have the following behaviour:
A blank frame is displayed over my spreadsheet when I try to display the UI Application and I'm asked to perform a "Save As" operation for an object userAppPanel.
On Chrome 16.x.x or Firefox 3.6, I have a UI application with a panel, a textbox and a button.
Here is my application creation code:
// Create my application
var mydoc = SpreadsheetApp.getActiveSpreadsheet();
var myapp = UiApp.createApplication();
myapp.setTitle("Translation selector");
// create panels, text boxes and widgets
var mypanel = myapp.createVerticalPanel();
// Create input boxes and button
var textBoxA = myapp.createTextBox();
textBoxA.setName('Input search filter here').setId('SearchText');
var MyButton = myapp.createButton("Fill the tables");
mypanel.add(textBoxA);
mypanel.add(MyButton);
// create handler to respond to events
var clickHandler = myapp.createServerClickHandler("respondToSubmit");
MyButton.addClickHandler(clickHandler);
clickHandler.addCallbackElement(mypanel);
// assemble everything in app
myapp.add(mypanel);
//mydoc.show(myapp);
//return myapp;
var doc = SpreadsheetApp.getActive();
// show the app
doc.show(myapp);
}
I've a similar issue on Chrome 21.0.1180.89 for OSX. Working with a mail merge script which worked perfectly on a, similar up-to-date, chrome on Win8 just a few hours ago.
I'm pretty sure it's a security issue.
De-authorising the app (under account->security) and then reloading the script and re-authorising it helps. Not sure if it's on a per-browser level or something else..
Kindly Add this Code,
As per your question, It works on chrome.
function saveTextAsFile()
{
var textToWrite = document.getElementById('area').value;
var textFileAsBlob = new Blob([textToWrite], {type:'text/plain'});
var fileNameToSaveAs = "ecc.plist"/*Your file name*/;
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
if (window.webkitURL != null)
{
// Chrome allows the link to be clicked
// without actually adding it to the DOM.
downloadLink.href =
window.webkitURL.createObjectURL(textFileAsBlob);
}
else
{
// Firefox requires the link to be added to the DOM
// before it can be clicked.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
downloadLink.onclick = destroyClickedElement;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
}
downloadLink.click();
}
I have some users of a script I've developed, FormEmailer (available in the Script Gallery) that are also having this problem. But we were not able to nail the situation that generates this yet.
Is the spreadsheet you're testing yours? Or is it shared and you're not the owner? Do you have other scripts projects on this same spreadsheet? Are you the owner of all scripts?
(I think it's better if you change you edit your question and I my answer, instead of talking in the "limited" comments).
I have the same problem :
More details about this after a few tests. It seems it is due both to user triggering the script to execute, as well as characteristics of the trigger :
- if the function is called from a custom menu in a spreadsheet, everything works fine for everyone
- if function is called onOpen(), everything works fine for everyone
- if an installable onEdit or onOpen trigger has been set on the function, then everything works fine for the person who set it, and bad for others.
The last behavior is observed whether that person is owner or not.
Basically it seems the only times when it doesn't work well is when someone opens or edits a spreadsheet and the function is triggered by an installable trigger installed by somebody else.
This is a pain.

Titanium: Youtube video

How can I show a youtube or bits on the run video full screen on my app? Is there a special link I have to naviate to? Or is there a special API that takes care of that to view it fullscreen?
The idea is to click on a link 'show video', then show the video fullscreen, and get a button play pauze and 'done'. When clicked done it goes back to the previous page.
I don't know how to get started on this one. Can anyone help me out?
I'm creating an iPhone app.
Thanks!
#Muhammad has the first part right but to get it to close when you hit the blue done button you'll need the following code.
replace
win.add(activeMovie);
activeMovie.play();
with
win.add(activeMovie);
activeMovie.fullscreen = 1; // this must be defined after you add to the window!
activeMovie.play();
then add this
activeMovie.addEventListener('fullscreen', function(e) {
if(!e.entering) { // this is run only when exiting fullscreen aka the blue done button
activeMovie.stop();
}
});
Here is a an example code to show video with controlls
var win = Titanium.UI.currentWindow;
var contentURL = 'http://movies.apple.com/media/us/ipad/2010/tours/apple-ipad-video-us-20100127_r848-9cie.mov';
var activeMovie = Titanium.Media.createVideoPlayer({
contentURL: contentURL,
backgroundColor:'#111',
movieControlMode:Titanium.Media.VIDEO_CONTROL_DEFAULT,
scalingMode:Titanium.Media.VIDEO_SCALING_MODE_FILL
});
win.add(activeMovie);
activeMovie.play();
Hope this will help.