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
 UI change if user changes variable
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

iggboert

Germany
7 Posts

Posted - 01/13/2009 :  08:22:18 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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, "Krzester 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

Iris_Bai

China
Posts

Posted - 01/15/2009 :  05:25:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

iggboert

Germany
7 Posts

Posted - 01/16/2009 :  09:15:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
oh, found a bug :) nice ...

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

Regards
igge
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