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
 GETNBOX Apply button. Passing datasets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

PhilTHy

UK
Posts

Posted - 02/13/2007 :  07:03:37 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 Pro
Operating System: Windows XP

I'm trying to create a tool as part of an application, where the user will adjust a fitting parameter until they are satisfied with the quality of fit by visual inspection of the plot.

To me the most intuitive way to do this is a numerical input dialog box, where the user presses "apply" when they have amended the numerical value of the parameter, and "OK" when they are happy.

But, the fitting function takes 8 dataset and two graphpage pointers as input parameters. A GETNBOX Apply function can only take a single Tree as input parameter.

***
So, is there a neat way to stick a pointer to a Dataset object onto a Tree?
***

The only other way I can think of doing it is messy. To write string nodes onto the passed tree, with the column and worksheet names to which the datasets are attached, and then use these string Nodes to reattach the column to duplicate dataset objects within the apply function. Messy and memory hungry as duplicate dataset objects are created.

Any other ideas?

Thanks

Phil

Mike Buess

USA
3037 Posts

Posted - 02/13/2007 :  10:23:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Phil,
quote:
To write string nodes onto the passed tree, with the column and worksheet names to which the datasets are attached, and then use these string Nodes to reattach the column to duplicate dataset objects within the apply function. Messy and memory hungry as duplicate dataset objects are created.
I doubt that this approach is as messy or memory hungry as you think. Memory for datasets created in the Apply function is probably released when you return to the Main function. String nodes can be hidden or disabled if you don't want user to modify them. If you don't like string nodes you can declare strings that can be used by all functions in your Origin C file...

static string str1;

void GetN_Main()
{
str1 = "datasetName";
// GetN code
}

static bool Apply(TreeNode& myTree, int nRow, int nType, Dialog& dlgGetNBox)
{
Dataset ds1(str1);
// do something with ds1
return true;
}

You can do the same with datasets themselves, but this will be memory hungry because the datasets remain in memory when you're done fitting.

static Dataset ds1;

void GetN_Main()
{
ds1.Attach("whatever");
// GetN code
}

static bool Apply(TreeNode& myTree, int nRow, int nType, Dialog& dlgGetNBox)
{
// do something with ds1
return true;
}

Mike Buess
Origin WebRing Member
Go to Top of Page

PhilTHy

UK
Posts

Posted - 02/14/2007 :  04:34:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Mike

You are right string nodes are much less messy than static variables. Brings back bad memories of FORTRAN 77 ...

Thanks for the tip about hiding the string nodes. I hadn't realised you could do this.

And it works more intuitively as an event handler function than an apply button function - as suggested by the parameter list in the function in your example.
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