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
 UI change if user changes variable

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
iggboert Posted - 01/13/2009 : 08:22:18 AM
Origin Ver.8 and SR4
Operating System: WINXP

Hello, I'm programming a little UI for entering some data. Now i want the UI to change when the User changes one Listbox.
Lets start :)


this is the code for the Tree:

GETN_TREE(tr)
	

	
	GETN_BEGIN_BRANCH(Start, "Ausgangsstellung")
	
		GETN_LIST(StartAchse, "Achse", 0, "P-Achse|Y-Achse") 
		GETN_SLIDEREDIT(AchsPosition, "Stellung", beta, alpha)
		GETN_STR(StartRadius, "aktueller Radius", "???")
		
	GETN_END_BRANCH(Start)

if( GetNBox(tr, "Kürzester Weg", "Achsenberechnung", NULL, Aenderungsabfrage) ) {}


this is the code for the function, when the user changes variables.

bool Aenderungsabfrage(TreeNode& tr, int nRow, int nType, Dialog& Dlg)
{

	if( nType == TRGP_CHECK || nType == TRGP_COLOR || nType == TRGP_SLIDEREDIT || nType == TRGP_STR )
	{
		return false;
	}
	if ( TRGP_ENUM_COMBO == nType)
	{
		switch( tr.Start.StartAchse.nVal )
		{
		case 0:
			tr.Start.Achsposition.strVal = 29;
			break;
		case 1:
			tr.Start.Achsposition.strVal = 24;
			break;
		default:
			tr.Start.Achsposition.strVal = 0;
			break;
		}
	}
return true;
}




Ok..., when the User changes the Variable "Achse" the Value of "Stellung" should change and the min|max|interval of the slider.

Unfortunately, the interface changes the value if I change the "Radius".
Another problem is, that i don't know the command to change the min|max|interval of the SLIDEREDIT-Button.

I hope you can help me.

Regards
igge
2   L A T E S T    R E P L I E S    (Newest First)
iggboert Posted - 01/16/2009 : 09:15:20 AM
oh, found a bug :) nice ...

thanks a lot for your help. I got it to work properly.

Regards
igge
Iris_Bai Posted - 01/15/2009 : 05:25:12 AM
Hi,

For first issue, I think this is a bug and need fix, but could you change your codes like the following only add event function for slider control:

#include <GetNBox.h>
void testGetN()
{
	GETN_TREE(tr)
	
	GETN_BEGIN_BRANCH(Start, "Start")
	
		GETN_LIST(StartAchse, "Start", 0, "AAA|BBB")   GETN_OPTION_EVENT(pos_event)
		GETN_SLIDEREDIT(AchsPosition, "Stellung", 0, "0|255|255")
		GETN_STR(StartRadius, "Name", "???")
		
	GETN_END_BRANCH(Start)

	if( GetNBox(tr, "Test", "Test") ) 
	{
	}
}

bool pos_event(TreeNode& tr, int nRow, int nType, Dialog& Dlg)
{
	out_str("StartAchse changed");
	string strMinMaxInterval = "1|100|20";
	tr.Start.Achsposition.SetAttribute(STR_COMBO_ATTRIB, strMinMaxInterval);
	
	switch( tr.Start.StartAchse.nVal )
	{
	case 0:
		tr.Start.Achsposition.strVal = 29;
		break;
	case 1:
		tr.Start.Achsposition.strVal = 24;
		break;
	default:
		tr.Start.Achsposition.strVal = 0;
		break;
	}
	
	return true;
}




To change min|max|interval of the slider you can do like:

string strMinMaxInterval = "1|100|20";
tr.Start.Achsposition.SetAttribute(STR_COMBO_ATTRIB, strMinMaxInterval);


Iris

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