Welcome! Log In Create A New Profile

Advanced

[WD11] Edit in Table

Posted by David Egan 
David Egan
[WD11] Edit in Table
October 01, 2008 06:12AM
Hi
I have a table control being used for data entry. If the operator wants to move to a previous row from a newly entered (unsaved) row I clear the row and put the operator in the new row still in edit mode. I had problems getting this to work because after using TableDelete the table was placed in Select mode but I solved that by forcibly clearing each cell in the line.
I now have a similar problem when going the other way which I haven't been able to solve. If the operator has gone to a previous row as above and now wants to return to adding the new row I want to force the operator to the first column in the row, regardless of where he enters the row. This only needs occur on new rows and I have a hidden column in the table which is only written when the row is completed so I can easily identify when I get to the new row. Whatever I try (ReturnToCapture, ScreenFirst, SetFocus) sets it to the first field but in select mode so I have the selection bar showing. Using the mouse or manually hitting enter clears this but using SendKey("{ENTER}",TableName) or other combinations which I have tried doesn't change anything. If I don't try forcing it to the first field on the row it stays in edit mode.
Any ideas?

Thanks

David
Jimbo
Re: [WD11] Edit in Table
October 01, 2008 08:15AM
Hi David,

ReturnToCapture(..) in Row Entry would do the trick to force a start of entry in Table column 1. However, though it depends on the data in the Table, personally, I do not enforce entering table data starting from the first column but I'm rather doing a validation in Row Exit. Validation can lead back to empty comlumns and enforce fully entered data.

I have an example for Table input / edit (btw it's a part of a German language 'What to do After RAD' cookbook):
[www.windev.at]
David Egan
Re: [WD11] Edit in Table
October 01, 2008 09:15AM
Hi Guenter
I tried ReturnToCapture which certainly puts you back to the first field in the row but it sets the row to Select Mode with the selection bar showing so the operator has to click it again or hit enter to start data entry and that's what I'm trying to avoid.
I fully agree with you on validation in Row Exit and that's what we're doing. I'd prefer to force the operator to the start of the row as well though as otherwise we are almost encouraging blank fields. I know our validation will pick it up before the record is saved but I don't think it looks very professional.

David
Jimbo
Re: [WD11] Edit in Table
October 01, 2008 09:43AM
Hi David, TRY my example. Only ReturnToCapture(..) is used and there is never selection mode - it's always in input mode. Guenter
David Egan
Re: [WD11] Edit in Table
October 01, 2008 10:51AM
Guenter, I'm still on WD11 so can't run your example unfortunately. I just tried ReturntoCapture again and I still have the same problem with the Selection Bar. I have managed a work around now as follows but I'd like to know why I have the problem using ReturnToCapture (and I have rebooted, deleted CPL folder, recompiled etc but always get the same result).
	li_row = TableColumnSubscript(MySelf,CurrentField(),tcpDisplay)
	FOR i = li_row TO 1 STEP -1
		SendKey("+{TAB}",Handle(Table_InvLines))
		IF CurrentField() = "col_LineType" THEN BREAK
	END

David

Al
Re: [WD11] Edit in Table
October 01, 2008 11:31AM
Hello David

This is a workaround that I use in the Row selection code of a memory table.
You have to select the line and put a value into it.

<pcode>

LTableRow = TableSelect(EFIT_TABLE)
IF EFIT_TABLE..NewLine THEN
ScreenFirst(EFIT_TABLE.ET_ITEMCODE)
//select the new line
TableSelectPlus(EFIT_TABLE,LTableRow)
//you need to put a value into the line to validate it
EFIT_TABLE.ET_LINENUM = LTableRow
//it is now in edit mode
END
</pcode>

Regards
Al
David Egan
Re: [WD11] Edit in Table
October 01, 2008 12:34PM
Thanks Al, that works. Based on Guenter's response I was wondering what I was doing wrong but you've obviously had a similar issue so I don't feel so bad now, apart from the fact that I've just spent a day & a half trying to get it working!

Cheers

David
Piet van Zanten
Re: [WD11] Edit in Table
October 02, 2008 04:35PM
Hi David,

I think if you do a returntocapture col_FirstCol[row] the column wil be in edit mode.
So you need the subscript of the current row (Currentsubscript)
Or you could set the table properties to WD55 compatible. However, that may pose other problems.

Regards,
Piet
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: