DCGET GETFOCUS with POPUP

This forum is for eXpress++ general support.
Post Reply
Message
Author
Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

DCGET GETFOCUS with POPUP

#1 Post by Andy Edward »

Hi Roger,

With this code, d and oldbank (inside compare function) is always the same even though oldbank was populated during GETFOCUS

So if I change the DCGET's value to something else, I should expect oldbank will retain the old value in order to compare between the old and new value.

What am I missing here?

Note: Xbase++ 2.0.721 and Express 2.0.263

Code: Select all


USE YTDAP NEW ALIAS GST 

@  0,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 200,200 ;
   OBJECT oBrowBox

@  1,1  DCBROWSE oBrowse ALIAS 'GST' SIZE 70,70 PARENT oBrowBox;
    PRESENTATION DC_BrowPres() ;
    EDIT xbeBRW_ItemSelected MODE DCGUI_BROWSE_EDITACROSSDOWN

SELECT GST
OLDBANK := SPACE(100)
DCSETPARENT oBrowse
 DCBROWSECOL FIELD GST->GLAMT    HEADER 'Bank'          WIDTH 8  PICTURE '@!' EDITOR 'BANK1';
          TOOLTIP 'Editable ONLY if the currency is based currency';
          HCOLOR GRA_CLR_BLUE,GRA_CLR_YELLOW    && 20080410

 @nil,nil DCGET bBLOCK1 GETID 'BANK1' PICTURE '@!';
     GOTFOCUS {|| OLDBANK:=GST->GLAMT};   && <----------------------------- 
     POPUP {|| DC_POPCALC()} GETSIZE 8;  && 20161026
     VALID {|o,x,d| d:=O:get:varget(), COMPARE(d, oldbank),DC_GETREFRESH(GETLIST),x} && <----------------------------- 

DCREAD GUI
RETURN

function COMPARE(d,olbank)
wtf d, oldbank
RETURN NIL
Regards,

Andy

User avatar
rdonnay
Site Admin
Posts: 4775
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCGET GETFOCUS with POPUP

#2 Post by rdonnay »

Put some debugging in your GOTFOCUS code block to see if it is getting evaluated.

Code: Select all

@nil,nil DCGET bBLOCK1 GETID 'BANK1' PICTURE '@!';
     GOTFOCUS {|| OLDBANK:=GST->GLAMT, (WTF OLDBANK)};   <<<<<<<<<<<<<<<<<<
     POPUP {|| DC_POPCALC()} GETSIZE 8;  && 20161026
     VALID {|o,x,d| d:=O:get:varget(), COMPARE(d, oldbank),DC_GETREFRESH(GETLIST),x} 
The eXpress train is coming - and it has more cars.

skiman
Posts: 1195
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCGET GETFOCUS with POPUP

#3 Post by skiman »

Maybe the following?

gotfocus {| a,b,o| OldBank :=O:get:varget() }
Best regards,

Chris.
www.aboservice.be

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: DCGET GETFOCUS with POPUP

#4 Post by Cliff Wiernik »

You need to put in some debugging. But just to let you know what we experienced in the past. It might also apply to the popup. We has a process whereby SSN (social security numbers), when displayed on the screen were masked as xxx-xxx-9999, but when the field was in focus, we changed value to be the actual SSN. We also have the ability via DCHOTKEY xbeK_F12 to allow the user to press the F12 key to print the current screen dialog. Pressing the F12 did not trigger the valid clause, that handled the returning of the actual SSN back to the masked version, but trigger a state so the GOTFOCUS clause was trigger without the corresponding lostfocus processing via the VALID to be processed.

We handled this by disabling the F12 key when in this field. Therefore the GOTFOCUS mask->actual, VALID actual->mask and so forth was always processed. Otherwise, we had instances where the masked value was saved into the file.

You may be experiencing something similar.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: DCGET GETFOCUS with POPUP

#5 Post by Andy Edward »

rdonnay wrote:Put some debugging in your GOTFOCUS code block to see if it is getting evaluated.

Code: Select all

@nil,nil DCGET bBLOCK1 GETID 'BANK1' PICTURE '@!';
     GOTFOCUS {|| OLDBANK:=GST->GLAMT, (WTF OLDBANK)};   <<<<<<<<<<<<<<<<<<
     POPUP {|| DC_POPCALC()} GETSIZE 8;  && 20161026
     VALID {|o,x,d| d:=O:get:varget(), COMPARE(d, oldbank),DC_GETREFRESH(GETLIST),x} 
It is being evaluated. I can see the old value.

I notice there are two scenarios,
First scenario - if I edit the cell by entering value via keyboard (ignoring the popup), the compare function will show two different values (old and new). This is correct.
Second scenario - If I edit the cell by using the popup which is a calculator, then I press ok on the calculator, the VALID will trigger and OLDBANK's value is replaced by the new value, which is not correct

Anything else that I'm missing?
skiman wrote:Maybe the following?

gotfocus {| a,b,o| OldBank :=O:get:varget() }
I tried this, and the behavior remains incorrect

User avatar
rdonnay
Site Admin
Posts: 4775
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCGET GETFOCUS with POPUP

#6 Post by rdonnay »

Change this:

POPUP {|| DC_POPCALC()} GETSIZE 8;

to this:

POPUP {|n| DC_POPCALC(n)} GETSIZE 8;
The eXpress train is coming - and it has more cars.

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: DCGET GETFOCUS with POPUP

#7 Post by Andy Edward »

Hi Roger,
rdonnay wrote:Change this:

POPUP {|| DC_POPCALC()} GETSIZE 8;

to this:

POPUP {|n| DC_POPCALC(n)} GETSIZE 8;
The same issue still persists. Any other ideas?

Regards,

Andy

Andy Edward
Posts: 103
Joined: Fri Sep 17, 2010 2:58 am

Re: DCGET GETFOCUS with POPUP

#8 Post by Andy Edward »

Hi Roger,

Here is the .exe where you can see the behaviour.

Thanks in advance.
getfocust.zip
(26.24 KiB) Downloaded 1216 times
Regards,

Andy

Post Reply