The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Xfunction access in C
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tinkusch

Germany
94 Posts

Posted - 07/07/2021 :  1:26:39 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Pro 2018G (64 bit)SR1
Operating System: Win10

I created an example xfunction with a GUI (gui_controls) from the examples in the manual. The GUI pops up and works fine with Labtalk but cannot be brought to display via an Origin C call.

I tried the below C-function with the result, that the output tree was just printed to the script window without opening the GUI.
Would be nice to get a hint.
Best,
Stefan

bool call_XF()
{
XFBase xf("gui_controls");
if (!xf)
return false;

Tree tr;
TreeNode trGetN;
xf.GetGUI(tr, trGetN);
xf.Run(AU_AUTO, trGetN);
return true;

}

cpyang

USA
1406 Posts

Posted - 07/08/2021 :  8:24:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
XF was implemented for using from LT, so can you show some code to show why you need to use it this way from OC?

CP
Go to Top of Page

tinkusch

Germany
94 Posts

Posted - 07/09/2021 :  05:23:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

XF was implemented for using from LT, so can you show some code to show why you need to use it this way from OC?

CP




Hi,
my aim is to create a dialog for an ORIGIN-App. OC-code provides better speed of the intended lengthy calculations with large matrices. I have seen other apps working also with dialogs, but as the code is not available it is however not clear to me how the dialog was created and handled. I thought an XF GUI would be an easy way for this.

Anyway, meanwhile I have found the OC GetN dialog option for creating dialogs, that will definitely do...
I have for what reason ever completely overlooked this up to now .

But just for clarity: is there a way to call an XF with a dialog from OC or do I have to use LT? OC help could probably describe the options in more details. For the XF.evaluate command dialog output is explicitly excluded, but one may learn this only from the comments in the code of the "Example with Controlling X-Function Settings Tree" in OC Help. However, there is also an example for running XF functions via the XF.run command. What is the difference between these two options?


Stefan

Edited by - tinkusch on 07/09/2021 05:36:35 AM
Go to Top of Page

Castiel

343 Posts

Posted - 07/09/2021 :  10:58:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by tinkusch

Origin Pro 2018G (64 bit)SR1
Operating System: Win10

I created an example xfunction with a GUI (gui_controls) from the examples in the manual. The GUI pops up and works fine with Labtalk but cannot be brought to display via an Origin C call.

I tried the below C-function with the result, that the output tree was just printed to the script window without opening the GUI.
Would be nice to get a hint.
Best,
Stefan

bool call_XF()
{
XFBase xf("gui_controls");
if (!xf)
return false;

Tree tr;
TreeNode trGetN;
xf.GetGUI(tr, trGetN);
xf.Run(AU_AUTO, trGetN);
return true;

}




xf.OpenGetNDialog() or something like that


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 07/09/2021 :  4:59:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you just need quick dialog, then just use GetNBox from OC, much simpler, and faster since XF has its overhead.

Most Apps from us are using HTML dialog from OC with some javascript.

You can also make an XF for your app and just launch the XF from the launch script.

If you need to get into GetNBox event handler, use the Ex3 on this page for the most comprehensive support

https://www.originlab.com/doc/OriginC/ref/GetNBox#Examples

CP
Go to Top of Page

tinkusch

Germany
94 Posts

Posted - 07/13/2021 :  04:44:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

If you just need quick dialog, then just use GetNBox from OC, much simpler, and faster since XF has its overhead.

Most Apps from us are using HTML dialog from OC with some javascript.

You can also make an XF for your app and just launch the XF from the launch script.

If you need to get into GetNBox event handler, use the Ex3 on this page for the most comprehensive support

https://www.originlab.com/doc/OriginC/ref/GetNBox#Examples

CP




Thanks CP, I'll work with GetNBox.
But just for my understanding. Could you please describe the difference between XF.run and XF.evaluate?
Thanks
Stefan

Go to Top of Page

cpyang

USA
1406 Posts

Posted - 07/13/2021 :  8:04:26 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
XF.run was introduced primarily to support recalculate, so if calling Run with AU_NONE, then it is essentially the same as Evaluate, but if AU_AUTO, it does not actually evaluate the XF but just construct the recalculation framework and let the recalculate to run the XF.

CP

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000