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
 X-Function Radio Button - get value, use in event1
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

TreeNode

64 Posts

Posted - 04/01/2010 :  11:00:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.8 SR6
Operating System: XP

Hi,

I want to use a "Radio Button" in X-Function, that controls - depending on selection - which
elements of the dialog are Enabled.

the method:
int my_xfunction_event1(TreeNode& trGetN, int nRow, int nEventID...
should check the selection of my "Radio Button", and then for example should
disable a "Combo Box" in my dialog.

I know how to disable the "Combo Box"...:

if(int nValueOfRadioButton == 0) // dont know how to get the current value of "Radio Button"
	bEnable = true;	         // in my_xfunction_event1 method
else
	bEnable = false;
	
	trGetN.combo.SetAttribute("Enable", bEnable);

... but I dont know how to get the integer value of my Input variable: int radio, Control: Radio: a|b|c
trGetN.radio.nVal (dVal, strVal) doesnt work, because node has no value. Could see that when viewing in debug mode.
And I cant find an Attribute where the current selection is stored.

I printed out all Attributes and its values of TreeNode trGetN.radio in my_function_event1,
and all values of Attributes stays the same, when switching "Radio Button" in dialog.

Can anybody help?

|-- TreeNode
...|-- a??
...|-- ha!!

Penn

China
644 Posts

Posted - 04/01/2010 :  10:15:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I have made a simple test with only a radio and a combo. In the body of _event1 function, the following code works.

int nRadio = trGetN.radio.nVal;  // get radio's value
out_int("radio=", nRadio);  // output radio's value
if(nRadio == 1)  // if the second option is selected
	trGetN.combo.Enable = false;  // disable combo
else
	trGetN.combo.Enable = true;  // other options, enable combo
return true;  // return true to update the dialog

I hope this can work in your computer too.

Penn
OriginLab Technical Services
Go to Top of Page

TreeNode

64 Posts

Posted - 04/07/2010 :  03:40:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

thank you for reply. Your example works fine.
I thought that I did it in the same way, so I didnt understood why it did not work.

Sadly I can not reproduce my mistake, because I deleted the code ;-/

I imagine that I used expression like : trGetN.tr.radio.nVal, because in other function
I used a GetN Tree with GETN_USE.

Because I remember that I received a error-message like:
"TreeNode doesnt exist, access denied". Perhabs that was my mistake.

Thank you very much for your help!

|-- TreeNode
...|-- a??
...|-- ha!!
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