Triggering the GUI

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
sebs
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Apr 02, 2018 3:56 pm

Triggering the GUI

Postby sebs » Thu Apr 12, 2018 4:58 pm

Hi, I am a bit of a starter with wxWidgets. I am trying to develop a program that that creates another one with a Fork. The idea is that one of them does some operations and the second one shows the interface that I have created with wxWidgets. I was wondering if anyone knows which method of the .h files that have been created should I add to the "main", or how i can do it so the program that generates the forks can trigger the interface that I have already created. Thanks in advance.

User avatar
doublemax
Moderator
Moderator
Posts: 12072
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Triggering the GUI

Postby doublemax » Thu Apr 12, 2018 6:36 pm

You ask like you expect this to be something simple. But it isn't.

Are both these applications under your control? If yes, i would highly recommend to turn them into one application.

If that's not possible, you need to implement some kind of messaging system between the two applications. This page might be helpful: http://docs.wxwidgets.org/trunk/overview_ipc.html

But of course, if only one of the two applications use wxWidgets and the other one doesn't, you still must find a way to communicate with each other.

Can you explain in more detail what you want to do? Maybe there is an easier solution.
Use the source, Luke!

sebs
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Apr 02, 2018 3:56 pm

Re: Triggering the GUI

Postby sebs » Fri Apr 13, 2018 11:54 am

They are two different applications. One process has to read data from the gpio of a Raspberry Pi and the other one has to reproduce in the interface the data read. I can not put both of them under the same process as I need to do this in multi-processing, due to time constraints. Thanks for any kind of help :D

User avatar
doublemax
Moderator
Moderator
Posts: 12072
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Triggering the GUI

Postby doublemax » Fri Apr 13, 2018 1:45 pm

Are both applications under your control?
Do they both use wxWidgets?

If the answer to both questions is "yes", look into the IPC link i posted before and check the "ipc" sample that comes with wxWidgets.

How much data will be sent from one process to the other per second/minute?
Is the message transfer one-directional? (Will only be data be sent from the "data" process to the "gui" process or do you need to sent messages in the other direction, too?)

If there is relatively little data, you could even try to use a file or an sqlite database to transfer the data. One process writes into a file or database and the other reads it from there.

Another option would be shared memory. wxWidgets has no support for this, but boost has:
https://www.boost.org/doc/libs/1_66_0/d ... esses.html
Use the source, Luke!

sebs
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Apr 02, 2018 3:56 pm

Re: Triggering the GUI

Postby sebs » Mon Apr 16, 2018 8:36 am

Both applications are under my control but both of them do not use wxWidgets, so the first option won't suit me. The data processing has to be done when demanded by the yser in the GUI after clicking one button from it, but once it is clicked, it has to go uner the 0.1 miliseconds range, but it is one directional. Do you recomend the database or the boost? Sorry for the delay and thank you very much.

User avatar
doublemax
Moderator
Moderator
Posts: 12072
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Triggering the GUI

Postby doublemax » Mon Apr 16, 2018 10:14 am

0.1 ms is very ambitious ;)

I've never used the shared memory from Boost, but using a database probably won't meet your performance demands.
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2343
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Triggering the GUI

Postby ONEEYEMAN » Mon Apr 16, 2018 4:38 pm

Hi,
Just curious - why not make a one application?
Create an application with the Frame and then start the secondary thread which will read the data.
When the user click the button, start updating the GUI with the info you already have.

Should work very nice and smooth.

Thank you.


Return to “C++ Development”

Who is online

Users browsing this forum: Bing [Bot], marcelinux and 7 guests