DCGET PICTURE "(999)999-9999" problem

This forum is for eXpress++ general support.
Message
Author
rsmarks
Posts: 27
Joined: Tue Nov 26, 2013 9:19 pm

DCGET PICTURE "(999)999-9999" problem

#1 Post 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.)

omni
Posts: 531
Joined: Thu Jan 28, 2010 9:34 am

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

#2 Post 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

rsmarks
Posts: 27
Joined: Tue Nov 26, 2013 9:19 pm

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

#3 Post 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.
Attachments
EXAMPLE.ZIP
(1.18 KiB) Downloaded 690 times

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

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

#4 Post 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)
The eXpress train is coming - and it has more cars.

WernerSt
Posts: 18
Joined: Thu Jan 28, 2010 3:48 am
Contact:

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

#5 Post 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

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

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

#6 Post 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
The eXpress train is coming - and it has more cars.

WernerSt
Posts: 18
Joined: Thu Jan 28, 2010 3:48 am
Contact:

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

#7 Post 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

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

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

#8 Post 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.
The eXpress train is coming - and it has more cars.

WernerSt
Posts: 18
Joined: Thu Jan 28, 2010 3:48 am
Contact:

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

#9 Post by WernerSt »

OK, kindly let me know when build 267 is available.

Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

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

#10 Post 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

Post Reply