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 » GridCtrl: assign default value & WhenAcceptRow
GridCtrl: assign default value & WhenAcceptRow [message #33541] Mon, 22 August 2011 10:22 Go to next message
forlano is currently offline  forlano
Messages: 1185
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 - Confused ). 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 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1366
Registered: November 2005
Location: Poland
Ultimate Contributor

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 - Confused ). 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 Go to previous message
forlano is currently offline  forlano
Messages: 1185
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

Previous Topic: ArrayCtrl and FileSel.ExecuteOK
Next Topic: GridCtrl and WhenMenuBar
Goto Forum:
  


Current Time: Fri Apr 19 01:54:52 CEST 2024

Total time taken to generate the page: 0.01856 seconds