Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Can't set value in switch with EnableValue  
	
		
		
			| Can't set value in switch with EnableValue [message #14557] | 
			Mon, 03 March 2008 19:09   | 
		 
		
			
				
				
				  | 
					
						  
						indiocolifa
						 Messages: 49 Registered: January 2008  Location: Argentina
						
					 | 
					Member  | 
					 | 
		 
		 
	 | 
 
	
		I'm trying to set a switch option from a database which stores an string (which is the value for the switch as I set them first). 
 
This is the code: 
 
UserEditWindow::UserEditWindow(String sel)
{
	CtrlLayout(*this, sel == "" ? "Nuevo Usuario" : "Editar Usuario " + sel);
	
	pwd.Password(true);
	optUserClass.Set(0, "ROOT", "Root (Administrador, privilegios totales)");
	optUserClass.Set(1, "FULL", "Full (Usuario completo, puede realizar altas)");
	optUserClass.Set(2, "CONSULTA", "Consulta (Restringido a realizar consultas)");
	
	if (sel == "")
	{
		editing = false;
		optUserClass.EnableValue("ROOT");
	}
	else
	{
		editing = true;
		
		// llenar campos 
		
		Sql sql((*(G_STATE->GetPsqlSession())));
		loginName = sel;
		realName.SetData(sql % Select(NOMBRE).From(OPERADOR).Where(LOGIN == sel));
		pwd.SetData(sql % Select(PASSWORD).From(OPERADOR).Where(LOGIN == sel));
		optUserClass.EnableValue(sql % Select(CLASE).From(OPERADOR).Where(LOGIN == sel));
	}
	
	// registra callbacks
	
	btnCancel.WhenAction = THISBACK(Close);
	btnOk.WhenAction = THISBACK(Save);
}
 
 
The line: 
 
 
optUserClass.EnableValue(sql % Select(CLASE).From(OPERADOR).Where(LOGIN == sel)); 
 
it's where where the data is retrieved from the DB to set the switch value (and I retrieve the correct data, strings such as ROOT,FULL,CONSULTA are taken OK from the DB table). 
 
I don't know why this does not work, since i'm setting the related values-text at first. 
 
Thx for your help. 
 
 
		
		
		[Updated on: Mon, 03 March 2008 19:10] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
  
 
Goto Forum:
 
 Current Time: Tue Nov 04 13:24:22 CET 2025 
 Total time taken to generate the page: 0.04702 seconds 
 |