Picture template on Resource Get not working.

Picture template on Resource Get not working.

Postby byron.hopp » Thu Jan 04, 2018 5:47 pm

I am wanting to setup a series of gets on a resource dialog where if the value is 0 (zero) it is blank, any other value to show.
The picture is 3 (three) characters wide.

I tried:

Redefine Get oCop01 var oOb:nCop01 ID 102 of oDlg Picture "@Z 999" // also tried "@Z ###"

My get is a "Tab Stop", "Right" aligned, "Case Insensitive", and "Multiple line".

On the Activate dialog command the oOb:nCop01 has a value of 0.
The get displays " 0" (should be blank), when the get gets focus it is blank, but any other value does not display as well.

Transform( oOb:nCop01,"@Z 999" ) returns " " or space(3) as expected.

Is there a better to do this on a get.

Thanks in advance...
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 386
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Picture template on Resource Get not working.

Postby nageswaragunupudi » Fri Jan 05, 2018 1:57 am

Specifying picture clause as "@Z 999" is right. "@Z ###" and "@Z 999" are same.
Get having focus displays "0" and other Gets not having focus show blank. That is normal behavior.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10681
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Picture template on Resource Get not working.

Postby byron.hopp » Fri Jan 05, 2018 7:07 am

Kind of, but in my documentation is states that:

# - digits, signs and blank spaces are allowed.
9 - digits, including signs, are allowed.

I thought that because the "@Z" was going to blank out the 0 (zero) then the "#" would work, but it did not seem to matter.

When I enter a number (1 - 9) on lost focus the number is blank.

Does this work for you correctly?

Seems my customer wants the 0 (zero) to be blank regardless of focus.
And at the same time they would like to see whatever number is populated regardless of focus.

Is there a way to do this other than picture?

I thought this was going to be easy.

Thanks,
Byron ...
Thanks,
Byron Hopp
Matrix Computer Services
byron.hopp
 
Posts: 386
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Picture template on Resource Get not working.

Postby nageswaragunupudi » Fri Jan 05, 2018 8:05 am

I am sorry, Gets always show 0.
Let me think of a solution for your requirement
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10681
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Picture template on Resource Get not working.

Postby nageswaragunupudi » Fri Jan 05, 2018 8:33 am

Can you try this program and give your comments
Code: Select all  Expand view  RUN
  local oDlg, oFont, aGet[ 5 ]
   local aNum  := { 0, 0, 0, 0, 0 }
   local aVar  := {}
   local c := "   "

   AEval( aNum, { |n,i| AAdd( aVar, Transform( aNum[ i ], "@Z 999" ) ) } )

   SetGetColorFocus()
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 300,500 PIXEL TRUEPIXEL FONT oFont

   @  20,50 GET aGet[ 1 ] VAR aVar[ 1 ] SIZE 150,24 PIXEL OF oDlg PICTURE "999" RIGHT
   aGet[ 1 ]:bValid := { |oGet| aNum[ 1 ] := Val( aVar[ 1 ] ), oGet:cText := Transform( aNum[ 1 ], "@Z 999" ), .t. }
   @  55,50 GET aGet[ 2 ] VAR aVar[ 2 ] SIZE 150,24 PIXEL OF oDlg PICTURE "999" RIGHT
   aGet[ 2 ]:bValid := { |oGet| aNum[ 2 ] := Val( aVar[ 2 ] ), oGet:cText := Transform( aNum[ 2 ], "@Z 999" ), .t. }
   @  90,50 GET aGet[ 3 ] VAR aVar[ 3 ] SIZE 150,24 PIXEL OF oDlg PICTURE "999" RIGHT
   aGet[ 3 ]:bValid := { |oGet| aNum[ 3 ] := Val( aVar[ 3 ] ), oGet:cText := Transform( aNum[ 3 ], "@Z 999" ), .t. }
   @ 125,50 GET aGet[ 4 ] VAR aVar[ 4 ] SIZE 150,24 PIXEL OF oDlg PICTURE "999" RIGHT
   aGet[ 4 ]:bValid := { |oGet| aNum[ 4 ] := Val( aVar[ 4 ] ), oGet:cText := Transform( aNum[ 4 ], "@Z 999" ), .t. }
   @ 160,50 GET aGet[ 5 ] VAR aVar[ 5 ] SIZE 150,24 PIXEL OF oDlg PICTURE "999" RIGHT
   aGet[ 5 ]:bValid := { |oGet| aNum[ 5 ] := Val( aVar[ 5 ] ), oGet:cText := Transform( aNum[ 5 ], "@Z 999" ), .t. }

   @ 210,50 BUTTON "OK" SIZE 100,40 PIXEL OF oDlg ACTION oDlg:End()
   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   XBROWSER aNum

 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10681
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests