XSample49()
Posted: Mon Feb 22, 2021 3:27 pm
I'm attempting to build a data entry browse based on XSample_49(), an array editor using DCBROWSE, DCBROWSECOL and DCGETs to implement the editing. (exp20\samples\xdemo\xsample2.prg)
But I want to Append a new row to the browse when the last field of each row is successfully VALIDated.
I expected this to be trivial using PostAppEvent(xbeP_Keyboard,xbeK_ALT_A,,oBrowse)
within the VALID function at line 971.
i.e. within _XSample49() the existing code is:
ELSEIF nAction = 4 // Validate field decimals
IF cFieldType $ 'cCdDlLmM'
aStructure[nPointer,4] := 0
ELSEIF nFieldDec > nFieldLen - 2
DC_WinAlert('Decimals cannot be greater than ' + ;
Str(nFieldLen-2))
RETURN .f.
ENDIF
// I've added the following line here:
PostAppEvent(xbeP_Keyboard,xbeK_ALT_A,,oBrowse) // <- force new row to be added to browse
ELSEIF nAction = 5
...
However no row is appended to the browse when expected, and:
1) the event viewer never shows the event as being received, but
2) the postappevent() returns .T.
A related observation is that the EVAL clause of the DCBROWSE does not seem to be performing it's intended function of adding a row when the browse cursor hits the bottom of the browse (except once, when the browse first opens):
EVAL {|o|o:hitBottomBlock := {||PostAppEvent(xbeP_Keyboard,xbeK_ALT_A,,oBrowse)} }
So, what am I missing? Shouldn't the PostAppEvent cause a row to be added to the browse?
Using 19SL1, Express++ build 20267, Win10
Many thanks,
Mark
But I want to Append a new row to the browse when the last field of each row is successfully VALIDated.
I expected this to be trivial using PostAppEvent(xbeP_Keyboard,xbeK_ALT_A,,oBrowse)
within the VALID function at line 971.
i.e. within _XSample49() the existing code is:
ELSEIF nAction = 4 // Validate field decimals
IF cFieldType $ 'cCdDlLmM'
aStructure[nPointer,4] := 0
ELSEIF nFieldDec > nFieldLen - 2
DC_WinAlert('Decimals cannot be greater than ' + ;
Str(nFieldLen-2))
RETURN .f.
ENDIF
// I've added the following line here:
PostAppEvent(xbeP_Keyboard,xbeK_ALT_A,,oBrowse) // <- force new row to be added to browse
ELSEIF nAction = 5
...
However no row is appended to the browse when expected, and:
1) the event viewer never shows the event as being received, but
2) the postappevent() returns .T.
A related observation is that the EVAL clause of the DCBROWSE does not seem to be performing it's intended function of adding a row when the browse cursor hits the bottom of the browse (except once, when the browse first opens):
EVAL {|o|o:hitBottomBlock := {||PostAppEvent(xbeP_Keyboard,xbeK_ALT_A,,oBrowse)} }
So, what am I missing? Shouldn't the PostAppEvent cause a row to be added to the browse?
Using 19SL1, Express++ build 20267, Win10
Many thanks,
Mark