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
 GETN Apply button

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
couturier Posted - 12/14/2017 : 2:49:26 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2018
Operating System: win10

Hi,

in a GETN box with Apply button, that button becomes inactive after 1st click and won't be active unless a change is made in the dialog.

Is it possible to have that Apply button always active ?

Thanks
12   L A T E S T    R E P L I E S    (Newest First)
couturier Posted - 12/21/2017 : 4:10:57 PM
I wanted to apply from within the dialog some operations that change the input data. User could see the effect of different options with apply, and could revert back to original data with cancel.

Don't mind with that, I could workaround it with the use of GETN_BUTTON_GROUP

thanks
yuki_wu Posted - 12/21/2017 : 04:36:24 AM
Hi,

I am sorry that it is also by design and there is no such option so far. I suppose we may hope the user to know that he cannot cancel the operation to reverse the last change and only click the Close button to close the dialog after he clicks the Apply button.

However, I would like to know why you want to keep showing Cancel if you don’t mind sharing your idea.

Regards,
Yuki
OriginLab
couturier Posted - 12/20/2017 : 06:02:23 AM
Thanks for your help.

Another thing:
Once user clicks the Apply button, the Cancel button becomes a Close button.
Is there any option so that the Cancel button keeps showing Cancel ?

thanks
yuki_wu Posted - 12/20/2017 : 12:53:43 AM
Hi,

Yes, we can set the alignment by GETN_OPTION_DISPLAY_FORMAT, for example:

GETN_BUTTON_GROUP(Button, "", 2, "Open...|Save...")
    	GETN_OPTION_DISPLAY_FORMAT(DISPLAY_EDITOR_LEFT)
	// GETN_OPTION_DISPLAY_FORMAT(DISPLAY_EDITOR_RIGHT)

However, the right-aligned button may not at the position you want to put:


Regards,
Yuki
OriginLab
couturier Posted - 12/19/2017 : 03:16:39 AM
I want my code to be compatible with O2016 so html dialog is not an option.

As for the GETN_BUTTON_GROUP buttons, it is possible to justify left or right with GETN_OPTION_DISPLAY_FORMAT.
Is it possible to center the buttons ?
yuki_wu Posted - 12/18/2017 : 10:24:27 PM
Hi,

It seems that the GetN GUI tree will be only updated when OK button is clicked at present. I am not sure if this is by design or a bug. I also put this issue into ID: ORG-17523, our developer will help to do further check later.

We cannot add a symbol to the button of a GetN box. If you want to make an App with the attractive GUI, I will suggest you try the new feature: Origin C HTML Dialog with JavaScript Support:
https://www.originlab.com/doc/OriginC/guide/HTML-Dialog

Regards,
Yuki
OriginLab

couturier Posted - 12/18/2017 : 4:51:53 PM
And a bonus question:
How to display a symbol (like that rightward triangle in save theme Xf) in a button ?

Thanks for the help
couturier Posted - 12/18/2017 : 3:17:28 PM
I have an additional question.

say I want to record the overall operation and output it IF users clicks Cancel:

static bool _action_event(TreeNode& trGUI, int nRow, int nCol, TreeNode& trNode, DWORD dwCntrl, int nType, WndContainer& theDlg)
{
	if (GETNEVENT_ON_INIT == dwCntrl)
		return true;
	
	DataRange dr;
	TreeNode trIX = trGUI.ix;
        int nFactor = trGUI.factor.nVal;
	okxf_resolve_tree_construct_range(&trIX, &dr);
	if (dr && dr.GetNumRanges() > 0)
	{
		Column col;
		range_get_col(dr, 0, col);
		if (col)
		{
			vectorbase& vv = col.GetDataObject();
			if (trNode.nVal == 0)
			{
				vv = vv * nFactor;
				trGUI.Total.dVal*=10;
			}
			else
			{
				vv /= nFactor;
				trGUI.Total.dVal/=10;
			}
		}
	}
	
    return true;
}
void GETN_BUTTON_ex()
{
    GETN_BOX( treeTest )
    GETN_INTERACTIVE(ix, "Input", "")
    GETN_NUM(factor, "Factor", 10)
    GETN_NUM(Total, "Total", 1)
    GETN_BUTTON_GROUP(action, "", 2, "Multiple|Divide")  GETN_OPTION_EVENT_EX(_action_event)
    GETN_CURRENT_SUBNODE.SetAttribute(STR_INTERACTIVE_CONTROL_OPTIONS_ATTRIB, 0x00400010);
    GETN_OPTION_DISPLAY_FORMAT(DISPLAY_EDITOR_HORZ|DISPLAY_EDITOR_RIGHT)
    
    if( GetNBox( treeTest, "Calculate", "" ))
        out_tree( treeTest );
    else out_double("total=", treeTest.Total.dVal);
}


treeTest.Total.dVal always outputs 1, even if it is correctly displayed in dialog.
How can I output what I see in the dialog ?
couturier Posted - 12/18/2017 : 07:00:34 AM
Thank you so much. Didn't know it was possible to add custom buttons.

This is exactly what I was looking for
yuki_wu Posted - 12/17/2017 : 10:04:11 PM
Hi,

Just like I mentioned before, Origin cannot keep the Apply button always active so far, but we have added this issue to our improvement tracking database: ID: ORG-17523. We may add a system variable to control it.

For now, we could replace the Apply button with a normal button. For example, the Multiple button and the Divide button in this example:

#include <origin.h>
#include <GetNbox.h>
#include <xfutils.h>
static bool _action_event(TreeNode& trGUI, int nRow, int nCol, TreeNode& trNode, DWORD dwCntrl, int nType, WndContainer& theDlg)
{
	if (GETNEVENT_ON_INIT == dwCntrl)
		return true;
	
	DataRange dr;
	TreeNode trIX = trGUI.ix;
        int nFactor = trGUI.factor.nVal;
	okxf_resolve_tree_construct_range(&trIX, &dr);
	if (dr && dr.GetNumRanges() > 0)
	{
		Column col;
		range_get_col(dr, 0, col);
		if (col)
		{
			vectorbase& vv = col.GetDataObject();
			if (trNode.nVal == 0)
				vv = vv * nFactor;
			else
				vv /= nFactor;
		}
	}
	
    return true;
}
void GETN_BUTTON_ex()
{
    GETN_BOX( treeTest )
    GETN_INTERACTIVE(ix, "Input", "")
    GETN_NUM(factor, "Factor", 10)
    GETN_BUTTON_GROUP(action, "", 2, "Multiple|Divide")  GETN_OPTION_EVENT_EX(_action_event)
    GETN_CURRENT_SUBNODE.SetAttribute(STR_INTERACTIVE_CONTROL_OPTIONS_ATTRIB, 0x00400010);
    GETN_OPTION_DISPLAY_FORMAT(DISPLAY_EDITOR_HORZ|DISPLAY_EDITOR_RIGHT)
    
    if( GetNBox( treeTest, "Calculate", "" ))
        out_tree( treeTest );
}

Hope it helps.

Regards,
Yuki
OriginLab
couturier Posted - 12/15/2017 : 03:35:54 AM
I fully understand that apply button needs to get inactive once clicked.
I have a particular case where I may want to repeatedly apply a computation on a dataset. So I was wondering if there was an option to keep that button activated.
yuki_wu Posted - 12/15/2017 : 01:01:23 AM
Hi,

I am sorry that we cannot keep the Apply button always active now.

I think it is easy to understand why the Apply button becomes inactive until you make some changes in GetN dialog. I mean the user will be easy to know if he has clicked the Apply button or not in such mechanism. I am wondering why you hope to keep it always active which may confuse the user sometimes. Could you please tell me your case?

Regards,
Yuki
OriginLab

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