Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » How set read-only state to a editable column?
How set read-only state to a editable column? [message #5505] Thu, 28 September 2006 11:22 Go to previous message
nicomesas is currently offline  nicomesas
Messages: 104
Registered: September 2006
Location: Barcelona, Spain
Experienced Member
Hi!
I have a ArrayCtrl with a list of data in which the two first entrances cannot be touched, are read-only. The other rows are read-write and can be removed.

Then, I can't know how to do this: to indicate to the ArrayCtrl that the two first rows are of read only.

the ArrayCtrl are defined :

.... 
theList.WhenEnterRow = THISBACK(TheListEnterRow);
...
theList.AddColumn(t_("data field")).Edit(editGrid) ;
...
...


Here we have the comented function WhenEnterRow.

void myDlg::TheListEnterRow()
{
  int row = theList.GetCursor() ;
  theList.Removing( row > 1 ) ; // do not remove the first 2 rows
  // with this test screen is not beauty because I cant enter in the edit field but i can't modify it
  editGrid.SetEditable(row > 1) ;

  // this other test is not good, the row entirely is disabled
  editGrid.Enable(row > 1) ;

  //This example is not good either since function YesClickEdit I have written 
  // and in addition she only prevents the fact to publish when I do click. 
  // I continue being able to publish with Ctrl+Enter
  if (row > 1)
    theList.ColumnAt(1).YesClickEdit() ; 
     // in CtrlLib/ArrayCtrl.h I Added
     // Column& YesClickEdit() { clickedit = true; return *this; }
  else
     theList.ColumnAt(1).NoClickEdit() ;

  // With this other example the result is catastrophic. Everything works bad
  if (row > 1)
    theList.ColumnAt(1).Edit(editGrid) ;
  else
    theList.ColumnAt(1).NoEdit() ;
  
  // In CtrlLib/ArrayCtrl.cpp I Added
  //ArrayCtrl::Column& ArrayCtrl::Column::NoEdit() 
  //{
  //  if (edit) {
  //    arrayctrl->RemoveChild(edit) ;
  //    edit = NULL ;
  //  }
  //  return *this;
  //}
}

I believe that the best thing would be to intercept the StartEdit function so that it recognizes a read-only column/row, that seems to you?

Nico
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: first row strange behaviour
Next Topic: functions of HeaderCtrl [REQUEST?]
Goto Forum:
  


Current Time: Tue May 14 10:30:12 CEST 2024

Total time taken to generate the page: 0.03166 seconds