Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtGridCellPercentage Collapse All
Subject Author Date
Offer Har Apr 16, 2007 - 6:00 AM

Dear Support,

I would like to use this cell type, but i think some functionality is missing to this cell type:
1) Usually percentage is in a very fixed range: 0-100. Does the control have any attribute to limit the range to 0-100?
2) The writing of fractions is less trivial to a user then writing the actual percentage number (writing 10 for 10% and not 0.1, which is not trivial). Again, is there any attribute i can apply that will enable this type of editing?

If these features do not exist, can you please add them to your tasks list, and let me know when they will be implemented.

Thanks,
Ron.

Technical Support Apr 16, 2007 - 11:18 AM

The CExtGridCellPercentage class implements a percentage cell, when the cell value is multiplied by 100 and the result is displayed with a percent symbol. So you could do the following:

1) Create a CExtGridCellNumber-derived class, which you will use for assigning integer values.

2) You can set a range for any numeric cell by overriding the OnQueryEnabledIncrement() and OnQueryEnabledDecrement() virtual methods. Here is the code that sets the range of 0 to 100 for your cell:

bool CYourGridCellPercentage::OnQueryEnabledIncrement() const
{
 ASSERT_VALID( this );
 if( intVal >= 100 )
  return false;
 return true;
}
 
bool CYourGridCellPercentage::OnQueryEnabledDecrement() const
{
 ASSERT_VALID( this );
 if( intVal <= 0 )
  return false;
 return true;
}


3) Override the TextGet() virtual method and implement it in a similar way as it is done in CExtGridCellPercentage::TextGet(). You methods should just add the percent sign to the formatted string representation of the numeric value.