Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Dec 12, 2017 1:31 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: turning control of a Realbasic program over to C++ (G++)
PostPosted: Sun Feb 03, 2008 10:40 am 
Offline

Joined: Mon May 21, 2007 12:01 pm
Posts: 4
Hello. I don't really want to write a plug-in per se. I find the C++ GUI's (especially Qt) extremely difficult. I would like to use RealBasic's GUI to enter data, and then execute C++ programs I have already written. The C++ application is some datamining software I use for my peculiar area of research ("foo"). All I need to do is store data entry from RealBasic into to a file and then when the C++ program is executed it reads the RealBasic generated "parameters" file and knows how to process the file in question. I was running the C++ application from the console, and entering parameters with a spreadsheet form, but now want to pretty all up with a customized GUI. So the outline is:

Begin RealBasic --> data entry --> RealBasic stores data entry into file "parameters.txt" --> RealBasic quits and C++ program takes over -->
C++ loads parameters.txt and also File_to_be_mined.txt --> C++ writes processed file.

It is the passing of the baton from RealBasic to G++ that I can't figure out

I use G++ under Linux Fedora 7

Please if possible write the exact command(s) I need (a snippet) if such exists.

I appreciate your help in advance

Thanks LD


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 03, 2008 11:49 am 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
Look into the Shell class
It lets you run command line tools in various ways


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 03, 2008 2:12 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Also look at FolderItem.Launch. Launch runs the program completely independent of your app - you can launch the other program and immediately quit your app. Shell requires that your app remain running, if I recall correctly.

Tim


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Feb 03, 2008 2:27 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
Shell would let you "hide" the C++ program from view entirely
But the RB program would keep running til the file was written

Launch will just run it as though you ran it from the command line

So there's at least a couple ways to do what you want


Top
 Profile  
Reply with quote  
 Post subject: running C++ from REAL basic
PostPosted: Tue Feb 05, 2008 6:08 pm 
Offline

Joined: Mon May 21, 2007 12:01 pm
Posts: 4
Thanks all. Based on suggestions I was able to use the Shell class to run C++ programs. As per below cmd ="make" represents the makefile for creating the C++ object code, and cmd2 runs the object file. Answers (linux command line results) spring into the editfield1 box. It really is quite cool, and I will give REALbasic thumbs up for allowing such easy access to C++ programs. Of course I have not delved to what extent. I can say my C++ program has a .h file with a main and a separate class file. I placed all in the same directory as RealBasic, and therefore haven't expored path compatibility. If any interested will keep posted on the experiment.

dim cmd as string
dim cmd2 as string
dim s as new shell
s = new shell
#if targetmacos or targetlinux and not(targetmacosclassic)
cmd="make"
cmd2 =" ./dm_toolkit_class" // program where my functions reside

#elseif targetwin32
cmd="set"
#endif

s.execute cmd //runs make
s.execute cmd2 // runs object
if s.errorcode=0 then
editfield1.text = s.result
else
editfield1.text = "error " +str(s.errorcode)
end if


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group