Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Is it possible to embed a Skylark app in a normal U++ GUI app?
Is it possible to embed a Skylark app in a normal U++ GUI app? [message #37930] Sat, 24 November 2012 01:22 Go to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
For example, can you run Skylark at the click of a button, instead of popping up the console as the main application loop?
Re: Is it possible to embed a Skylark app in a normal U++ GUI app? [message #37934 is a reply to message #37930] Sat, 24 November 2012 09:45 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

lectus wrote on Sat, 24 November 2012 01:22

For example, can you run Skylark at the click of a button, instead of popping up the console as the main application loop?

Yes, it is... Although it is little complicated. The main problem is that SkylarkApp has it own event loop, so you need to run it in separate thread if you want to use GUI at the same time. Also, AFAIK it is currently not possible to stop SkylarkApp (only using signals). However, if you can live with these minor problems, you can have a GUI app that has http interface and you can even make the handlers communicate with GUI via PostCallback. You could probably communicate the other way with a little of work too, but I didn't try.

Attached is a proof of concept code. It is not a nice code, I just quickly hacked it together, so it might be slightly unreadable Smile The main idea is that actions on htpp interface (which is taken from Skylark01 tutorial) are communicated to GUI which displays them in title bar. If you have some other questions, perhaps explaining what exactly would you like to achieve, feel free to ask Wink

Best regards,
Honza

  • Attachment: main.cpp
    (Size: 1.42KB, Downloaded 191 times)
Re: Is it possible to embed a Skylark app in a normal U++ GUI app? [message #37944 is a reply to message #37934] Sat, 24 November 2012 13:42 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Thanks for the answer!

Hmm.. I think it might be easier to build my GUI app separated and then a webinterface.exe that's launched with ShellExecute ( http://msdn.microsoft.com/en-us/library/windows/desktop/bb76 2153(v=vs.85).aspx) with SW_HIDE parameter to hide the console Window. Or possibly with U++ LocalProcess class for a portable way.

Then when I want it to quit (at the click of the "Quit" button) it can be send to a http://localhost:8001/myapp/quit page, which in Skylark handler code will just end the application process.

Now I'm getting a little bit hacky here, but I can see it working in my mind.
Re: Is it possible to embed a Skylark app in a normal U++ GUI app? [message #37953 is a reply to message #37944] Sat, 24 November 2012 15:22 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

lectus wrote on Sat, 24 November 2012 13:42

Hmm.. I think it might be easier to build my GUI app separated and then a webinterface.exe that's launched with ShellExecute ( http://msdn.microsoft.com/en-us/library/windows/desktop/bb76 2153(v=vs.85).aspx) with SW_HIDE parameter to hide the console Window. Or possibly with U++ LocalProcess class for a portable way.

Then when I want it to quit (at the click of the "Quit" button) it can be send to a http://localhost:8001/myapp/quit page, which in Skylark handler code will just end the application process.

Yes, that would of course work too... I just didn't know how much do you need it to cooperate Smile If you just need start/stop capability, than it could be much simpler, even when used directly from the GUI part as a thread, especially if you are ok with having a method on interface that triggers the exit (which is by the way in most cases not a good idea, unless it is somehow secured Wink )

Honza
Previous Topic: complex applications GUI best practices?
Next Topic: Raspberry (Raspbian) - ARM 6 Core + Ultimate++?
Goto Forum:
  


Current Time: Thu Mar 28 23:30:34 CET 2024

Total time taken to generate the page: 0.01967 seconds