Page 1 of 1

Empty text variable in TGET

PostPosted: Fri May 26, 2023 10:24 am
by Natter
Hi,

Is it possible to make it possible to enter text into an empty text variable in TGET (a la Excel)
Code: Select all  Expand view
function Main()
local oDlg, [b]cText := ""[/b]

  DEFINE DIALOG oDlg   FROM 2, 2 TO 20, 50    TITLE "Example"
     TGet():New( 2, 2, bSETGET( cText ), oDlg, 100,,   [b]replicate("X",10)[/b] )
  ACTIVATE DIALOG oDlg CENTERED
return

Re: Empty text variable in TGET

PostPosted: Fri May 26, 2023 4:02 pm
by nageswaragunupudi
We advise you to use Edit control, which is very similar to Get control. Edit control allows input of variable length.
Code: Select all  Expand view
cVar2 := ""
  @  60,20 EDIT oEdit VAR cVar2 SIZE 200,20 PIXEL OF oDlg
 


In case of Unicode applications, (when FW_SetUnicode( .t. )), we can use Get control also with the clause "VARCHAR n"
Code: Select all  Expand view
  local oDlg, oGet, oEdit
   local cVar1 := ""
   local cVar2 := ""

   FW_SetUnicode( .F. )

   DEFINE DIALOG oDlg SIZE 300,300 PIXEL TRUEPIXEL

   @  20,20 GET oGet VAR cVar1 SIZE 200,20 PIXEL OF oDlg ;
      VARCHAR 20

   @  60,20 EDIT oEdit VAR cVar2 SIZE 200,20 PIXEL OF oDlg

   @ 100,20 BUTTON "CHECK" SIZE 100,40 PIXEL OF oDlg ;
      ACTION MsgInfo( "|" + cVar1 + "|" + CRLF + "|" + cVar2 + "|" )

   ACTIVATE DIALOG oDlg CENTERED
 


For ANSI applications, it is a good idea to use EDIT control

Re: Empty text variable in TGET

PostPosted: Fri May 26, 2023 4:30 pm
by Natter
Thanks, I'll try! By the way, the Backspace is working incorrectly in TGET (for FWH 2210)

Re: Empty text variable in TGET

PostPosted: Sat May 27, 2023 9:41 am
by nageswaragunupudi
Natter wrote:Thanks, I'll try! By the way, the Backspace is working incorrectly in TGET (for FWH 2210)

Can you please explain this more clearly to help us to locate the problem, if any?