Validating SLE entry

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
Anonymous

Validating SLE entry

Post by Anonymous »

I've crawled all over the old NG, seen this mentioned quite often, but no real successes it seems.

I have a SLE (I've tried RightSLE and SearchSLE also) on my screen. It's called PO Number. What I need to achieve is as the user is typing in that field AND/OR after the cursor leaves the field (tried EditFocusChange unsuccessfully) it searches to see if that particular PO number is already in the system. If so, I need a warning box to popup telling the user it already exists, and give them 3 options - View Other record, Continue with it or cancel. This window I have already built. It's the validating that I can't seem to get.

Any ideas please?
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Validating SLE entry

Post by wriedmann »

Hi Jeff,
the EditFocusChange() event works when the focus on a edit control is changed, and it definitely works - I'm using it massively. But this event often is called twice, first for the control that is leaved, and then for the control that is entered.
To catch changes in an edit control itself, you need the EditCHange() event, and access the value of the control through the TextValue access.
But what you should not do in both events: do anything that shifts the focus, for example opening a messagebox.
It is much better to use an error display control.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
BiggyRat

Validating SLE entry

Post by BiggyRat »

Hmmmm thanks Wolfgang, that might go a fair way to explaining what's going on. Thanks very much :)

This what I had been experimenting with...

if self:oSFJobInfo_DETAIL:oDCPONumber:ValueChanged
oDb := DETAILS{}
oDb:SetOrder("PONUMBER", "DETAILS")
oDb:GoTop()
oDb:OrderScope( TOPSCOPE, AllTrim(self:oSFJobInfo_DETAIL:oDCPONumber:CurrentText))
oDb:OrderScope( BOTTOMSCOPE, AllTrim(self:oSFJobInfo_DETAIL:oDCPONumber:CurrentText))

IF oDb:OrderKeyCount("PONUMBER", "DETAILS") > 1
DuplicateRef{}:Show(SHOWCENTERED) <--a Dialog Window I created.3 buttons as described in my first post. It does absolutely NOTHING except display, and the Close button has EndDialog in it.at this point

endif

oDb:OrderBottomScope
oDb:OrderTopScope
oDb:GoTop()
oDb:SetOrder("JOBNUMBER", "DETAILS")
oDb:GoTop()
self:oSFJobInfo_DETAIL:oDCPONumber:ValueChanged := FALSE
endif

It works OK, but kills the relationship and indexes between Client.dbf and Details.dbf...It's in the Update Button though, not really the desired outcome, but will do if need be.

Jeff
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

Validating SLE entry

Post by lumberjack »

Hi Jeff,
BiggyRat wrote:I have a SLE (I've tried RightSLE and SearchSLE also) on my screen. It's called PO Number. What I need to achieve is as the user is typing in that field AND/OR after the cursor leaves the field (tried EditFocusChange unsuccessfully) it searches to see if that particular PO number is already in the system. If so, I need a warning box to popup telling the user it already exists, and give them 3 options - View Other record, Continue with it or cancel. This window I have already built. It's the validating that I can't seem to get.
Ok you will probably have to play with this a bit, as I have my EditFocusChange event on the Control level, but the principle is the same:

Code: Select all

METHOD FocusChange( oFCE ) CLASS ODI_SLE
	IF IsMethod( SELF:Owner, #FocusChangeEditControl )
		SELF:Owner:FocusChangeEditControl( SELF, oFCE:GotFocus )
	ENDIF
RETURN NIL
I think the magic trick you after is the FocusChange() method, not EditFocusChange() and oFCE:GotFocus property.

HTH,
______________________
Johan Nel
Boshof, South Africa
BiggyRat

Validating SLE entry

Post by BiggyRat »

Excellent. Thank you Johan, I'll give that a try.
Post Reply