Author | Topic: how to validate a get when losing the focus | |
---|---|---|
Jorge L. Borlando | how to validate a get when losing the focus on Wed, 19 Sep 2018 12:02:11 -0300 hello group, I need help please I am analyzing the coltest.exe example located in \ALASKA\XPPW32\source\samples\solution\xbpget in a column I added a validation function that runs in the method XbpGet:Keyboard () fine my problem is generated when I modify one cell and then with the mouse I go to another cell, the validation function is not executed and it updates the data of the cell Could you tell me what the indicated callback would be to analyze the cell change made with the mouse and thus execute the validation that allows me or not to change the value of the cell? my idea is that when I move the mouse, if the validation is successful the cell is updated, else the cell recovers its original value I hope your help, thank you very much | |
Jorge L. Borlando | Re: how to validate a get when losing the focus on Wed, 19 Sep 2018 12:48:02 -0300 Hello I have discovered that :: GetData is executed first than :: KillInputFocus () which also executes the validation ...., but the objective is to evaluate if it can execute the validation in :: GetData () without having to have e validate 2 times "Jorge L. Borlando" <jlborlando@yahoo.com.ar> wrote in message news:12f39d00$3d7a9364$233d9@news.alaska-software.com... > hello group, I need help please > > I am analyzing the coltest.exe example located in > \ALASKA\XPPW32\source\samples\solution\xbpget > > in a column I added a validation function that runs in the method > XbpGet:Keyboard () fine > > my problem is generated when I modify one cell and then with the mouse I > go to another cell, the validation function is not executed and it updates > the data of the cell > > Could you tell me what the indicated callback would be to analyze the cell > change made with the mouse and thus execute the validation that allows me > or not to change the value of the cell? > > my idea is that when I move the mouse, if the validation is successful the > cell is updated, else the cell recovers its original value > > I hope your help, thank you very much | |
Zupan Miran | Re: how to validate a get when losing the focus on Wed, 19 Sep 2018 17:51:47 +0200 I use topdown lib: tdSay( 2.0, 3," Something to say: ",oDa,20,'L',{tdBLU,tdPBL},cSayFont) oGet1:= tdXget(2.0,15,{|| a1 }, oDa,4,oDlg,"9999",bValid,,,,,,.T.,.F.,tdBG,.T.,.T.,,,,,,,,,,,,,aGetColor) oGet1:setData() aadd(aGets,oGet1) ..... more gets //*** Assign Get array to Dlg cargo *** oDlg:cargo := aGets setAppFocus(oGet2) nEvent := 0 DO WHILE nEvent <> xbeP_Close nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN nil The button SAVE calls Function "Shrani" (which is "save" STATIC FUNCTION shrani(oDlg,oGet1,novi) LOCAL aGets := oDlg:cargo LOCAL nSifra:= aGets[1]:editbuffer() //*** check it again for whatever you want *** //*** IF empty(nSifra) .and. novi=.T. tdMsg("FIELD MUST BE .... ","",tdWARN,{tdWHI,tdDRD},"11.Arial CE",,,,,,5,"Opozorilo") setAppFocus(oGet1) ELSE //*** save *** IF novi=.T. dbappend() REPLACE str_mat->zapst with aGets[1]:editbuffer() ENDIF RLOCK() REPLACE str_mat->dokument with aGets[2]:editbuffer(),; str_mat->datum with ctod(aGets[3]:editbuffer()),; str_mat->partner with val(aGets[4]:editbuffer()) ,; str_mat->opombe1 with aGets[5]:editbuffer(),; str_mat->opombe2 with aGets[6]:editbuffer(),; str_mat->znesek with aGets[7]:vrni(),; str_mat->dat_val with ctod(aGets[8]:editbuffer()),; str_mat->datum_pla with ctod(aGets[9]:editbuffer()),; str_mat->naziv_par with kretpom4 DBUNLOCK() DBCOMMIT() ENDIF RETURN nil Best regards Miran Zupan --- Ta e-pošta je bila pregledana z Avast protivirusnim programom. https://www.avast.com/antivirus | |
Jorge L. Borlando | Re: how to validate a get when losing the focus on Fri, 21 Sep 2018 15:17:01 -0300 Hi Zupan I found the soluction in XbpGetColumn:hiliteRow method regards "Zupan Miran" <spczupan@spc-zupan.si> wrote in message news:58bb4c16$1f22cd55$23164@news.alaska-software.com... > I use topdown lib: > > tdSay( 2.0, 3," Something to say: ",oDa,20,'L',{tdBLU,tdPBL},cSayFont) > oGet1:= tdXget(2.0,15,{|| a1 }, > > oDa,4,oDlg,"9999",bValid,,,,,,.T.,.F.,tdBG,.T.,.T.,,,,,,,,,,,,,aGetColor) > oGet1:setData() > aadd(aGets,oGet1) > > ..... more gets > > //*** Assign Get array to Dlg cargo *** > oDlg:cargo := aGets > > > setAppFocus(oGet2) > > nEvent := 0 > DO WHILE nEvent <> xbeP_Close > nEvent := AppEvent( @mp1, @mp2, @oXbp ) > oXbp:handleEvent( nEvent, mp1, mp2 ) > ENDDO > RETURN nil > > The button SAVE calls Function "Shrani" (which is "save" > > > STATIC FUNCTION shrani(oDlg,oGet1,novi) > LOCAL aGets := oDlg:cargo > LOCAL nSifra:= aGets[1]:editbuffer() > > //*** check it again for whatever you want *** > //*** > IF empty(nSifra) .and. novi=.T. > tdMsg("FIELD MUST BE .... ","",tdWARN,{tdWHI,tdDRD},"11.Arial > CE",,,,,,5,"Opozorilo") > setAppFocus(oGet1) > ELSE > //*** save *** > IF novi=.T. > dbappend() > REPLACE str_mat->zapst with aGets[1]:editbuffer() > ENDIF > RLOCK() > REPLACE str_mat->dokument with aGets[2]:editbuffer(),; > str_mat->datum with ctod(aGets[3]:editbuffer()),; > str_mat->partner with val(aGets[4]:editbuffer()) ,; > str_mat->opombe1 with aGets[5]:editbuffer(),; > str_mat->opombe2 with aGets[6]:editbuffer(),; > str_mat->znesek with aGets[7]:vrni(),; > str_mat->dat_val with ctod(aGets[8]:editbuffer()),; > str_mat->datum_pla with ctod(aGets[9]:editbuffer()),; > str_mat->naziv_par with kretpom4 > DBUNLOCK() > DBCOMMIT() > ENDIF > RETURN nil > > Best regards > Miran Zupan > > --- > Ta e-pošta je bila pregledana z Avast protivirusnim programom. > https://www.avast.com/antivirus > | |
Carlos a Beling | Re: how to validate a get when losing the focus on Mon, 24 Sep 2018 16:58:03 -0300 Hello Jorge: amny thanks. I think that in the method :enter() you can to get the SetAppFocus() anf retrore it after the execution of the method :activate(). Is it correct? Fraternally Beling Em 21/09/2018 15:17, Jorge L. Borlando escreveu: > Hi Zupan > > I found the soluction in XbpGetColumn:hiliteRow method > > regards > > "Zupan Miran" <spczupan@spc-zupan.si> wrote in message > news:58bb4c16$1f22cd55$23164@news.alaska-software.com... >> I use topdown lib: >> >> tdSay( 2.0, 3," Something to say: ",oDa,20,'L',{tdBLU,tdPBL},cSayFont) >> oGet1:= tdXget(2.0,15,{|| a1 }, >> >> oDa,4,oDlg,"9999",bValid,,,,,,.T.,.F.,tdBG,.T.,.T.,,,,,,,,,,,,,aGetColor) >> oGet1:setData() >> aadd(aGets,oGet1) >> >> ..... more gets >> >> //*** Assign Get array to Dlg cargo *** >> oDlg:cargo := aGets >> >> >> setAppFocus(oGet2) >> >> nEvent := 0 >> DO WHILE nEvent <> xbeP_Close >> nEvent := AppEvent( @mp1, @mp2, @oXbp ) >> oXbp:handleEvent( nEvent, mp1, mp2 ) >> ENDDO >> RETURN nil >> >> The button SAVE calls Function "Shrani" (which is "save" >> >> >> STATIC FUNCTION shrani(oDlg,oGet1,novi) >> LOCAL aGets := oDlg:cargo >> LOCAL nSifra:= aGets[1]:editbuffer() >> >> //*** check it again for whatever you want *** >> //*** >> IF empty(nSifra) .and. novi=.T. >> tdMsg("FIELD MUST BE .... ","",tdWARN,{tdWHI,tdDRD},"11.Arial >> CE",,,,,,5,"Opozorilo") >> setAppFocus(oGet1) >> ELSE >> //*** save *** >> IF novi=.T. >> dbappend() >> REPLACE str_mat->zapst with aGets[1]:editbuffer() >> ENDIF >> RLOCK() >> REPLACE str_mat->dokument with aGets[2]:editbuffer(),; >> str_mat->datum with ctod(aGets[3]:editbuffer()),; >> str_mat->partner with val(aGets[4]:editbuffer()) ,; >> str_mat->opombe1 with aGets[5]:editbuffer(),; >> str_mat->opombe2 with aGets[6]:editbuffer(),; >> str_mat->znesek with aGets[7]:vrni(),; >> str_mat->dat_val with ctod(aGets[8]:editbuffer()),; >> str_mat->datum_pla with ctod(aGets[9]:editbuffer()),; >> str_mat->naziv_par with kretpom4 >> DBUNLOCK() >> DBCOMMIT() >> ENDIF >> RETURN nil >> >> Best regards >> Miran Zupan >> >> --- >> Ta e-pošta je bila pregledana z Avast protivirusnim programom. >> https://www.avast.com/antivirus >> | |
Jorge L. Borlando | Re: how to validate a get when losing the focus on Tue, 25 Sep 2018 18:43:05 -0300 Hi Carlos, in \Alaska\XppW32\source\samples\solution\xbpget\editbrow example, when I modify a cell of XbpBrowse() and then with the mouse I want to go to another cell, in XbpGetColumn:hiliteRow method, where it performs :GetData() to fix the XbpGet() data to the field of the dbf before losing the focus and move to the new cell, which is in where I could add the XbpGet:PostValidation and thus update the dbf or execute the XbpGet:undo() in the xbpgetcolumn class I had to change the ivar xbpget from PROTECTED to EXPORTED and I added the ivar bValidate to be able to validate the data in the edition part of the original code of XbpGetColumn:hiliteRow IF ::xbpGet:changed ::xbpGet:getData() ::xbpColumn:refreshRows( nRowPos, nRowPos ) ENDIF ::xbpGet:hide() proposed code - If ::xbpGet:changed If ( ::bValidate = NIL .Or. ( ::bValidate != NIL .And. Eval( ::bValidate, ::xbpGet, ::xbpGet:value, NIL, NIL, nRowPos ) ) ) ::xbpGet:getData() Else ::xbpGet:Undo() EndIF ::xbpColumn:refreshRows( nRowPos, nRowPos ) EndIF ::xbpGet:hide() I hope to explain correctly, thank you very much "Carlos a Beling" <beling@bipbip.com.br> wrote in message news:4b6974b0$790590b3$21672@news.alaska-software.com... > Hello Jorge: > amny thanks. > I think that in the method :enter() you can to get the SetAppFocus() anf > retrore it after the execution of the method :activate(). Is it correct? > > Fraternally > Beling > > Em 21/09/2018 15:17, Jorge L. Borlando escreveu: >> Hi Zupan >> >> I found the soluction in XbpGetColumn:hiliteRow method >> >> regards >> >> "Zupan Miran" <spczupan@spc-zupan.si> wrote in message >> news:58bb4c16$1f22cd55$23164@news.alaska-software.com... >>> I use topdown lib: >>> >>> tdSay( 2.0, 3," Something to say: ",oDa,20,'L',{tdBLU,tdPBL},cSayFont) >>> oGet1:= tdXget(2.0,15,{|| a1 }, >>> >>> oDa,4,oDlg,"9999",bValid,,,,,,.T.,.F.,tdBG,.T.,.T.,,,,,,,,,,,,,aGetColor) >>> oGet1:setData() >>> aadd(aGets,oGet1) >>> >>> ..... more gets >>> >>> //*** Assign Get array to Dlg cargo *** >>> oDlg:cargo := aGets >>> >>> >>> setAppFocus(oGet2) >>> >>> nEvent := 0 >>> DO WHILE nEvent <> xbeP_Close >>> nEvent := AppEvent( @mp1, @mp2, @oXbp ) >>> oXbp:handleEvent( nEvent, mp1, mp2 ) >>> ENDDO >>> RETURN nil >>> >>> The button SAVE calls Function "Shrani" (which is "save" >>> >>> >>> STATIC FUNCTION shrani(oDlg,oGet1,novi) >>> LOCAL aGets := oDlg:cargo >>> LOCAL nSifra:= aGets[1]:editbuffer() >>> >>> //*** check it again for whatever you want *** >>> //*** >>> IF empty(nSifra) .and. novi=.T. >>> tdMsg("FIELD MUST BE .... ","",tdWARN,{tdWHI,tdDRD},"11.Arial >>> CE",,,,,,5,"Opozorilo") >>> setAppFocus(oGet1) >>> ELSE >>> //*** save *** >>> IF novi=.T. >>> dbappend() >>> REPLACE str_mat->zapst with aGets[1]:editbuffer() >>> ENDIF >>> RLOCK() >>> REPLACE str_mat->dokument with aGets[2]:editbuffer(),; >>> str_mat->datum with ctod(aGets[3]:editbuffer()),; >>> str_mat->partner with val(aGets[4]:editbuffer()) ,; >>> str_mat->opombe1 with aGets[5]:editbuffer(),; >>> str_mat->opombe2 with aGets[6]:editbuffer(),; >>> str_mat->znesek with aGets[7]:vrni(),; >>> str_mat->dat_val with ctod(aGets[8]:editbuffer()),; >>> str_mat->datum_pla with ctod(aGets[9]:editbuffer()),; >>> str_mat->naziv_par with kretpom4 >>> DBUNLOCK() >>> DBCOMMIT() >>> ENDIF >>> RETURN nil >>> >>> Best regards >>> Miran Zupan >>> >>> --- >>> Ta e-pošta je bila pregledana z Avast protivirusnim programom. >>> https://www.avast.com/antivirus >>> |