problem when clicking a button in the executable of a project

571
10
02-14-2018 03:56 AM
ikbelkachbouri
New Contributor II

I created a project with the MapViewr model of AppStudio for arcgis. When clicking (in .exe) on a button that opens a file an error message appears to me: no application is installed to allow opening of this type of link (qrc).

0 Kudos
10 Replies
TinaJin
Esri Regular Contributor

Hi Ikbel,

Thank you for asking your question in our Geonet community. I need more information about your issue.  When you say "created a project" do you mean created a Map Viewer app using AppStudio Desktop or AppStudio Website.  What button have you clicked on?  Do you mind providing a screenshot of the error message?

Thanks,

Tina 

ikbelkachbouri
New Contributor II

Hi Tina thanks for your question,

created a Map Viewer app using AppStudio Desktop. when I execute it from Appstudio everything works very well but after having made the generation from appstudio of arcgis on line the buttons (which open files) do not work and a message appears to me (no application is installed to allow the opening of this type of link (qrc)).

0 Kudos
TinaJin
Esri Regular Contributor

Hi Ikbel,

Are you using Cloud Make tool to create a standalone Map Viewer app on Windows platform? I was not able to reproduce your issue.  Here are my steps,

  1. Create and upload a Map Viewer app
  2. Use Cloud Make tool to create a standalone app for Windows 
  3. Go to AppStudio OTA  to download the app to my Windows
  4. The app was successfully downloaded and installed on my Windows

I would call Esri technical support to troubleshoot the issue. 

Thanks,

Tina 

0 Kudos
ikbelkachbouri
New Contributor II

Thanks Tina ,

Good I detail you my problem.

I created an application with appstudio for arcgis whose first interface

has buttons each of them opens a file.

when i run the appcation from Appstudio for arcgis everything works fine

and by clicking the buttons the files open.

my problem is that after the generation of the application and executing

the .exe the buttons do not work and the action of opening the files does

not work and an error message appears to me: you will need to a new

application to open this .qrc element.

2018-02-15 19:56 GMT+01:00 Tina Jin <geonet@esri.com>:

GeoNet <https://community.esri.com/?et=watches.email.thread>

Re: problem when clicking a button in the executable of a project

reply from Tina Jin

<https://community.esri.com/people/TJin-esristaff?et=watches.email.thread>

in AppStudio for ArcGIS - View the full discussion

<https://community.esri.com/message/750853-re-problem-when-clicking-a-button-in-the-executable-of-a-project?commentID=750853&et=watches.email.thread#comment-750853>

0 Kudos
TinaJin
Esri Regular Contributor

Hi Ikbel,

Could you please provide the screenshot of the button you are talking about?

Thanks,

Tina 

0 Kudos
StephenQuan1
Esri Contributor

Hi Ikbel, what you're describing is actually by design.

When you create and run an app from within AppStudio Desktop, all your source files both your .qml, .txt and .doc files resides on disk. You can referred to them with relative references which is why you can open .txt and .doc files with relative links in your app since your app will translate the relative references to absolute references to files to your disk as it opens.

However, the trap is, if you build your app using App Make, all your source files will be compiled and deployed with your app as a Qt Resource File (i.e. qrc). Most of Qt's components, will recognize both relative references to disk or Qt Resource File indifferently. For instance, if your app has .png images, you can use the Image component to display them.

However, if your app is wanting to supply a relative reference to an external process, i.e. for Windows to open, you need to use the FileFolder component to copy the files from a resource to a disk. If you don't, Windows will not have a clue what to do.

import QtQuick 2.7
import QtQuick.Controls 2.1
import ArcGIS.AppFramework 1.0

App {
    id: app

    width: 400
    height: 640

    Button {
        text: qsTr("Copy and Open")

        onClicked: {
            dest.removeFile("readme.txt");
            dest.copyFile(source.filePath("readme.txt"), dest.filePath("readme.txt"))
            Qt.openUrlExternally(dest.fileUrl("readme.txt"));
        }
    }

    FileFolder {
        id: source
        url: "."
    }

    FileFolder {
        id: dest
        path: "~"
    }

}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Hope that makes sense.

Stephen

0 Kudos
ikbelkachbouri
New Contributor II

Hi Stephen,

I think you understand my problem exactly. I want to explain more.

Well I worked with the AppStudio_x64_2_1_19 version.

I modified the homepage according to my needs which are two buttons one

opens the gallery which is the same one of you and the other opens such

type of file (.mxd, .doc, .txt, ...).

Everything works fine when I click on the Execute button of Appstudio for

arcgis desktop, the problem is in the. exe got after generating the

application, the primer button starts and opens the gallery but the second

does not open the file and an error message appears to me: no application

is installed to allow the opening of this type link (qrc).

can you explain to me more how to use the FileFolder component to copy the

files from a resource to a disk ( the absolute path does not work contrary

to the relative path).

Thanks.

2018-02-28 5:22 GMT+01:00 Stephen Quan <geonet@esri.com>:

GeoNet <https://community.esri.com/?et=watches.email.thread>

Re: problem when clicking a button in the executable of a project

reply from Stephen Quan

<https://community.esri.com/people/SQuan-esristaff?et=watches.email.thread>

in AppStudio for ArcGIS - View the full discussion

<https://community.esri.com/message/753697-re-problem-when-clicking-a-button-in-the-executable-of-a-project?commentID=753697&et=watches.email.thread#comment-753697>

0 Kudos
StephenQuan1
Esri Contributor

Ikbel,

In my previous answer, I supplied a complete working code snippet.

Please use it in a standalone app with a `readme.txt` resource.

The code snippet explains how to copy from resource (i.e. source) to file system (i.e. dest) and opens the file.

Stephen

0 Kudos