Problem with htmlviewer on desk application

Hi

im developing a webapplication that you can see here at http://67.205.191.197/BeautyStore-Dev/ (xojo cloud)
Im using a Sqlite database that can be downloaded directly from the webapp pushing the button “Exportar” (Export), this because i have a companion (desktop application) that will read and print the information from the downloaded DB
So on the web side all works fine.

So from de Desktop side i have a htmlviewer that load the page of my webapplication.
From the htmlviewer i can navigate my web application, adding new information, deleting, filtering showing other pages without any problem.

The only thing that i cannot do is download the sqlite db because no dialog windows open, (pressing the “Exportar” button) and i do not the reason and i do not how to figure how the solution.

Any suggestion?

Thanks a lot for the help

Alan

Hello Alan

I have just tried this from Chrome on Windows 10 and the using the Exportar button in the top right does download the sqlite DB. What is your environment that you experiencing the issue on.

Many Thanks
Shawn

HI Shawn

From all browsers works fine, the issue that im facing is when im using the htmlviewer from a Xojo Desktop Application, so you cannot open a windows dialog to perform the download.

Hi

There is a solution to my issue?

Thanks

Alan, before asking for a solution, you need to provide readers with a full picture. You keep talking about a desktop application.

Whenever you ask such questions, it would help greatly if you described the platform (Windows ? Mac ?) And eventually the renderer under Windows (native ? Webkit ?).

Another issue here : I tried to access your web app from an HTMLViewer on Mac, and It get the message that it is an unsupported browser. You want to implement the Session.AllowUnsupportedBrowser event and return True in there.

What would be great, really, is that you post in the Windows or Mac channel instead of General, so it provides at least an indication on the platform. You can change channel by clicking Controls, and Change Channel.

I believe there is a solution, but the minimum is to be able to display the site in order to experiment.

Check the NewWindow event. That may give you the URL, and then you can probably just use an httpsocket to get the file.

OK. This is getting ridiculous : I get the browser not supported message in native renderer as well under Windows.

It works under WebKit, though. But that should not happen.

Check the URL in CancelLoad. When you see an sqlite file, show a SaveAsDialog, and if the user did not cancel, use an HTTPSocket to download.

Then return True.

Hi Michael

Just to clarify one thing, im posting in the general channel as the problem that im facing is on both platform MAC & Windows and from my side (i guess) is not practical post onto 2 different channel for the same problem.

In my first post i posted that everything is working fine , the only problem is that a windows dialog is not opening when pressing “Export” button as is working well directly from the web application.

Now in Htmlviewr the code in the follow events is:

CancelLoad

If NewWin then
ShowURL(URL)
NewWin = False
Return true
end if

NewWindows

NewWin = True
Return me

Open

if me.IsAvailable then
dim agent as string

agent = “Mozilla/6.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/533.16 (KHTML, like Gecko) Version/9.1.3 Safari/11601.7.8”
//agent=""
me.UserAgent = agent

end if

me.LoadURL(“http://67.205.191.197/BeautyStore-Dev/”)

The windows of the HTMLViewer as a property called NewWin as Boolean

For the last i tried WebKit and Native Render on both MAC & Windows but without result

Any suggestion.

Alan, I just told you what to do. NewWin won’t do anything.

Just look at the kind of file in CancelLoad, and if it is not HTML, download it with HTTPSocket.

You also want to solve your unsupported browser issue.

Hi Michel

I do not have unsupported browser issue as im not getting any error related with, also because can be fixed calling the userAgent propriety of the HTMLViewer.

In the canceload event of the HtmlViewer i correct the NewWin to True, the Render is Native , so is working fine with windows 10 in all browsers.

With MAC same settings is not working at all, why ?

Hi Michel

Anyway here im sharing the project just for check if you like and have time for it.

Thanks

[quote=327586:@Alan Castellana]Hi Michel

I do not have unsupported browser issue as im not getting any error related with, also because can be fixed calling the userAgent propriety of the HTMLViewer.

In the canceload event of the HtmlViewer i correct the NewWin to True, the Render is Native , so is working fine with windows 10 in all browsers.

With MAC same settings is not working at all, why ?[/quote]

Alan,

I am sorry, but I see the unsupported browser on Windows 10 Creator Edition with native Renderer. I did not invent it.

Since apparently you did not find my assistance good enough as you told in the Español channel, I will stop here. Good luck.

This is exactly what you must do to make it work. I told you that 6 posts ago.

Hi Michel

Im sorry but i never mention that you support is not good enough, because what i meant is that i did not get the logical solution to my problem because my language barrier.

So do not take it personally.

What is clear to me is after i sent project and links in order to take a look on what can be the problem and may be found out the correct solution for this kind of issue that can help ordinary people like me, which by the way are spending a lot of money in xojo license renew , xojo cloud and plugins from everywhere, as all books author from the xojo library, instead the solution i get your reaction. Wow

Anyway thanks a lot for your effort and hope no bother you in the future with my troubles.

Thanks

Alan,

It is not a question of language barrier. I gave you exactly what to do and you went on with all sorts of considerations that have nothing to do.

What is it you don’t understand in these two simple phrases :

Let me put it into a list :

  1. Check the URL in CancelLoad (the CancelLoad event, NOT the newWindow one)
  2. When you see an sqlite file (as the end of the URL is “.sqlite”)
  3. show a SaveAsDialog (so the user can pick the file name he wants)
  4. Check the user did not cancel (value returned by SaveAsDialog is not nil)
  5. Use an HTTPSocket to download the file

I even went as far as linking to SaveAsDialog and HTTPSocket in the original post.

Your reply is to post your project. No, it does not work that way. I will not write the code for you. You have to learn how to do it by yourself, and make an effort to understand what I told you.

What bothers me is not that you ask, is that visibly you make no personal effort to understand what I suggested.

Hi

I want to thanks all of you for supporting and trying to solve my problem.
Antonio Rinaldi who is an Italian Xojo Evangelist and well known in this forum, got the solution that i was looking for my problem.
Thanks to him and to you all, i can appreciate more using Xojo as the right developing tool.

And in order to close this topic, my final and very personal comment is:

Bad teachers = bad students
Good teachers = good students

Never fails

Thanks to all

Alan

Alan, ingratitude is never a good thing. What I posted works. I use it myself. You simply did not seem to want to grasp it. Sometimes good teachers grapple with bad students.

Hi Michel

I want recall my first sentence, “I want to thanks all of you for supporting and trying to solve my problem.” and please stop to be polemic. I never been offensive to you and always i thanks everybody for their effort, even if the solution is nor working for mine needs.

The solution that you post is working for you but not for me. Antonio offer me a better solution that solve my problem.
This does not mean that you are not good enough, i never said that and i always thank you since i met you in this forum.

I do not have the expertise that you have, and this is the reason why im asking for help in this forum. I never asked to you directly to solve my problems , or doubts, but again thanks anyway (and im very sincere on this, believe it or not, is up to you) for spending your time, to try and i say and quote again “try” to solve whatever the problem is.
Finally i have more than 20 apps in Apple Store that people download every day, and you are part of this too. So thanks again.
What im looking for in this forum is solution for every problem and not a problem for every solution.

And this comments Bad teachers = bad students ,Good teachers = good students have a purpose:

As i consider you a good teacher, do not turn bad because a bad student like me, instead try to turn me in a good student.

Finally pizza is pizza but there are many different ways to prepare it.

Bye

It is customary in this forum to post the final solution to a question.

Please, enlighten us, and post the code that you got from the good teachings of Antonio, so we all learn.

Be my guest:

OK ho modificato il tuo progetto (attento ho levato la cartella delle icone perch non erano dentro l’archivio quindi mi davano errore)

Il principio semplice:
Giusto utilizzare il cancelLoad. Qui devi vedere se l’URL ha l’estensione che vuoi scaricare (o puoi volendo mettere altri controlli)
In questo caso fai apparire la finestra per salvare il file e salvi

Invece che creare cose “strane” nella finestra ho creato 1 classe e una finestra.
La classe una sottoclasse di HTMLViewer che gestisce il cancelLoad. Se deve fare le “sue cose” le fa altrimenti chiama l’evento per l’istanza
Per verificare le “sue cose” divide l’url vede se il file (l’ultimo elemento dell’URL) ha una estensione compatibile (per ora ho aggiunto un vettore di stringhe che inizializzi nell’Open, potresti usare un vettore di FileType per porre poi il giusto filtro al momento del salvataggio)
Se compatibile mostra la finestra per salvare il file (volendo potresti avere posizioni fisse e decidere immediatamente dove salvare o creare un evento per ottenere la destinazione del file)
Se viene assegnato il file (ovvero dove salvare) chiama la finestra di download (altro elemento creato) che in pratica scarica il file mostra il progresso e si chiude da sola.

link text

You can download even the example to be more “enlighten” if can help, but translation is on your own.