Page 1 of 2

DCGET PICTURE "(999)999-9999" problem

Posted: Thu Apr 18, 2019 9:04 am
by rsmarks
When a DCGET with a PICTURE "(999)999-9999" is first entered, the cursor is correctly positioned in the first blank spot immediately after the (. However, when you start typing a number, the cursor moves back to the ( position and no numbers are displayed. You have to use an arrow key or mouse to move the cursor back to the position after the ( before numbers can be entered. (The variable in the DCGET is initially set to all blanks.)

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Fri Apr 19, 2019 3:08 pm
by omni
Use this all the time. i set the initial variable to that format. so it would be "( ) - ".
Goes right past the non-numbers.
Do that on all my phone numbers.

Fred
Omni

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Sun Apr 21, 2019 9:59 am
by rsmarks
Alas, that did not work. I am using Version 2.0 build 266 with Xbase++ 2.0 build 1023. I've attached a very simple program to demonstrate.

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Tue Apr 23, 2019 10:08 am
by rdonnay
It works properly in build 264 but fails with 265 and 266.

Here is the solution.
The function DC_XbpGetSetInputFocusBlock() was added in build 265 because it was requested by several eXpress++ users that they want to control the behavior of DCGET objects when they get focus and kill focus.

Unfortunately, the new default behavior is messing with your picture clause.
I will work on a solution in build 267.

Here is the workaround you need to put in your code (build 265 or later) to force it to the original behavior :

Code: Select all

Function MAIN()
  oRootWindow:=SetAppWindow()
  nMaxCol:=oRootWindow:maxCol
  nFontWidth:=oRootWindow:fontWidth

  DC_XbpGetKillInputFocusBlock( {|x,y,o|  ;
                        IIF(o:isGetDataOnLostFocus,o:getData(),nil), ;
                        IIF(o:isGetDataOnLostFocus,o:setData(),nil), ;
                        o:home(), ;
                        DC_HiliteGets(o,2,o:getList:getOptions[nGETOPT_HILITECOLOR]), ;
                        DC_ColorGets(o,2,o:getList:getOptions[aGETOPT_COLORGETS]), ;
                        DC_PopupButtonShow(o,.f.)})

  DC_XbpGetSetInputFocusBlock( {|x,y,o| ;
                       o:DateFlag := .T., ;
                       o:Home(), ;
                       DC_HiliteGets(o,1,o:getList:getOptions[nGETOPT_HILITECOLOR]), ;
                       DC_ColorGets(o,1,o:getList:getOptions[aGETOPT_COLORGETS]), ;
                       DC_PopupButtonShow(o,.t.)})

  MyPanApp()

 RETURN (Nil)

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Wed Apr 24, 2019 3:17 am
by WernerSt
Roger,
because I have the same Problem I tried to use your solution, but the Compiler reports the error "unresolved external Symbol DC_popupbuttonshow".
My express-Version is 266.

Werner

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Wed Apr 24, 2019 6:36 am
by rdonnay
"unresolved external Symbol DC_popupbuttonshow"
It appears that you are using build 265.
DC_PopupButtonShow() was added in build 266.

This workaround will also require that you add this small function to your code.

Code: Select all

FUNCTION DC_PopupButtonShow( oGet, lShow )

IF !DC_GetPopupAutoHide() .OR. Empty(oGet:popupButton)
  RETURN nil
ENDIF
IF lShow
  oGet:popupButton:show()
ELSEIF SetAppFocus() # oGet:popupButton
  oGet:popupButton:hide()
ENDIF

RETURN nil

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Wed Apr 24, 2019 9:49 am
by WernerSt
Roger,
thank you for this completion. Now the Compiler is satisfied.
I bought the current Express++ build 266 in August 31, 2018 so it's strange you suppose I work with 265.
Maybe you added this function DC_popupbuttonshow later to build 266?
Regards, Werner

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Wed Apr 24, 2019 10:26 am
by rdonnay
Maybe you added this function DC_popupbuttonshow later to build 266
I must have been mistaken.
I guess I added it to my current build which is not yet released.

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Wed Apr 24, 2019 11:16 am
by WernerSt
OK, kindly let me know when build 267 is available.

Re: DCGET PICTURE "(999)999-9999" problem

Posted: Thu Aug 04, 2022 1:48 am
by Diego Euri Almanzar
Hello Roger, hello everyone.

I have started using version 2.0 of Express, which I bought last year. And, the only problem I have is precisely this, the picture in the phone numbers. I have added the source code you indicate to my project, but it doesn't work for me. I must be doing something wrong.

Could you help me please?



IF !DC_GetPopupAutoHide() .OR. Empty(oGet:popupButton)
RETURN nil
ENDIF
IF lShow
oGet:popupButton:show()
ELSEIF SetAppFocus() # oGet:popupButton
oGet:popupButton:hide()
ENDIF

RETURN nil