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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 GETNBOX Apply button. Passing datasets

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PhilTHy Posted - 02/13/2007 : 07:03:37 AM
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
2   L A T E S T    R E P L I E S    (Newest First)
PhilTHy Posted - 02/14/2007 : 04:34:14 AM
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.
Mike Buess Posted - 02/13/2007 : 10:23:43 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000