Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » GridCtrl: assign default value & WhenAcceptRow
GridCtrl: assign default value & WhenAcceptRow [message #33541] |
Mon, 22 August 2011 10:22 |
|
forlano
Messages: 1182 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
I have two question about GridCtrl with embedded ctrls via .Edit():
1) is there a way to assign a default value when creating a new row? With ArrayCtrl exists InsertValue(...), for axample:
array.AddColumn(COUNTRY,"Country").Edit(country).InsertValue(12);
Is there an equivalent/alternative way?
2) before the row is accepted I want to check its data and eventually refuse them and force the user to continue the edit task.
I used the WhenAcceptRow to perform the checking (as done with ArrayCtrl but there it is a Gate - ). Unfortunatly the row is always accepted.
Which is the suggested method with GridCtrl to validate the data?
This one works for ArrayCtrl but with GridCtrl complain about 'bool' returning value of the callback.
Thanks,
Luigi
[Updated on: Mon, 22 August 2011 10:22] Report message to a moderator
|
|
|
Re: GridCtrl: assign default value & WhenAcceptRow [message #33542 is a reply to message #33541] |
Mon, 22 August 2011 10:32 |
|
forlano wrote on Mon, 22 August 2011 04:22 |
1) is there a way to assign a default value when creating a new row? With ArrayCtrl exists InsertValue(...), for axample:
array.AddColumn(COUNTRY,"Country").Edit(country).InsertValue(12);
Is there an equivalent/alternative way?
|
grid.AddColumn(COUNTRY, "Country").Edit(country).Default(12);
Quote: |
2) before the row is accepted I want to check its data and eventually refuse them and force the user to continue the edit task.
I used the WhenAcceptRow to perform the checking (as done with ArrayCtrl but there it is a Gate - ). Unfortunatly the row is always accepted.
Which is the suggested method with GridCtrl to validate the data?
This one works for ArrayCtrl but with GridCtrl complain about 'bool' returning value of the callback.
|
In WhanAcceptRow callback use grid.CancelAccept()
|
|
|
Re: GridCtrl: assign default value & WhenAcceptRow [message #33543 is a reply to message #33542] |
Mon, 22 August 2011 11:10 |
|
forlano
Messages: 1182 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
unodgs wrote on Mon, 22 August 2011 10:32 |
In WhanAcceptRow callback use grid.CancelAccept()
|
Thank you, it works (permit me to continue to edit the row and correct it) but how to accept the row and set cancel_accept to false? I cannot move to another row to edit and the application cannot be closed.
I tried grid.Accepting() but no result.
thanks,
Luigi
EDIT: I was silly... just
grid.cancel_accept=false;
at the end of the callback do the job!
[Updated on: Mon, 22 August 2011 11:15] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu Mar 28 15:47:21 CET 2024
Total time taken to generate the page: 0.01072 seconds
|