Problem with get / Tget object

Problem with get / Tget object

Postby eduardofreni » Sun Aug 27, 2006 12:44 am

I use in the get object, bChange for to know step by step the characters typewrite in a variable.
Fivewin report across nkey the chr number of last character typed.
But if i call the VarGet() method for read the total character typed, he not return me, nothing for the first 2 character. After typede 3 character the method return me the first character typed.

I send the code sample, test it. It's Very strange. This limit the use of get system.
I have fivewin 2.7, xHarbour 99.60.
The code:

#include "FiveWin.ch"

function Main()

local oDlg, oGet1, n1 := " "

DEFINE DIALOG oDlg TITLE "Testing Gets"

@ 1, 1 GET oGet1 VAR n1 SIZE 80, 11

oGet1:bChange={ |nkey , nFlag| test(nkey,nFlag,@oGet1)}

@ 3, 11 BUTTON "Ok" ACTION oDlg:End()

ACTIVATE DIALOG oDlg CENTERED

return nil

procedure test(nkey,nFlag,oGet1)
Local CharContainer
CharContainer := oGet1:VarGet()
? CharContainer
? chr(nkey)
msgalert("You Write "+CharContainer,"Write?")
return
User avatar
eduardofreni
 
Posts: 12
Joined: Sat Aug 26, 2006 12:27 am
Location: Florence (Italy)

Postby Antonio Linares » Sun Aug 27, 2006 11:01 am

Eduardo,

Try it this way:
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

local oDlg, oGet1, n1 := Space( 20 )

DEFINE DIALOG oDlg TITLE "Testing Gets"

@ 1, 1 GET oGet1 VAR n1 SIZE 80, 11

oGet1:bChange={ |nkey , nFlag| test(nkey,nFlag, oGet1, oDlg)}

@ 3, 11 BUTTON "Ok" ACTION oDlg:End()

ACTIVATE DIALOG oDlg CENTERED

return nil

procedure test(nkey,nFlag,oGet1,oDlg)
   Local CharContainer
   CharContainer := oGet1:GetText()
   oDlg:SetText( CharContainer )
return
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

the dialog go to error

Postby eduardofreni » Tue Aug 29, 2006 12:07 am

When i test with fwh the sample give an error at this row:
oDlg:SetText( CharContainer )
To me seems that the problem is in the dialog that does not have the method.

But, if i take the character in CharContainer and add chr(nKey) the problem are solved.
Is solvable the problema, for get all character from buffer of keyboard?

I know how this problem more complicated. It is necessary to go to touch the winproc. Excuse me.

Many thanks for your prompt answer.
Best Regards.
Saludos
Eduardo Freni

PS excuse for bad english
User avatar
eduardofreni
 
Posts: 12
Joined: Sat Aug 26, 2006 12:27 am
Location: Florence (Italy)

Postby Antonio Linares » Tue Aug 29, 2006 7:58 am

Eduardo,

Please copy and build the entire sample that I have posted. It works fine.

Probably you are missing oDlg in your code.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Ok work

Postby eduardofreni » Tue Aug 29, 2006 2:42 pm

Is true, i not have passed, the oDlg at procedure test.
Now i passed and no error in procedure.
But, how to see CharContainer not contain all character typed in the string, but the string with character -1, character captured from nkey

Thanks for all.
Best regards

#include "FiveWin.ch"

function Main()

local oDlg, oGet1, n1 := " "

DEFINE DIALOG oDlg TITLE "Testing Gets"

@ 1, 1 GET oGet1 VAR n1 SIZE 80, 11

oGet1:bChange={ |nkey , nFlag| test(nkey,nFlag,@oGet1,@oDlg)}

@ 3, 11 BUTTON "Ok" ACTION oDlg:End()

ACTIVATE DIALOG oDlg CENTERED

return nil

procedure test(nkey,nFlag,oGet1,oDlg)
Local CharContainer
CharContainer := oGet1:GetText()
oDlg:SetText( CharContainer )
? chr(nkey)
? CharContainer
return
User avatar
eduardofreni
 
Posts: 12
Joined: Sat Aug 26, 2006 12:27 am
Location: Florence (Italy)

Postby James Bott » Tue Aug 29, 2006 5:29 pm

Try this:

procedure test(nkey,nFlag,oGet1,oDlg)
Local CharContainer
CharContainer := oGet1:varGet() // changed
msgInfo( charContainer )
oDlg:SetText( CharContainer )
? chr(nkey)
? CharContainer
return
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Silvio » Tue Aug 29, 2006 5:35 pm

Edo, why this PHOTO ?
<-------------------------<
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

My photo?

Postby eduardofreni » Tue Aug 29, 2006 8:43 pm

Hello Silvio, how are you?
My photo?
Becouse is the only in black and white.
For reduce the dimensions of image.

Why not?

Buona vida Silvio.

Eduardo Freni
User avatar
eduardofreni
 
Posts: 12
Joined: Sat Aug 26, 2006 12:27 am
Location: Florence (Italy)

Estimando James Bott

Postby eduardofreni » Tue Aug 29, 2006 9:12 pm

It is one unexpected and appreciate surprised your mail.

I study and appreciate your manual on FiveWin Class. Me has been much profit.

For the procedure the problem is this.
I must extract the characters, who come directly typed, from the buffer of an object get. Possibly the entire string, not a character for time.
I cannot attend the valid, I must make it before.
For this I have made this post.

I have mistaken method?
I do not know, task to have made how much was necessary.
OnChange, would have gives the possibility to me to approach the buffer of the characters written in the get.

Thanks for all James Bott.

Best Regards

Eduardo Freni
User avatar
eduardofreni
 
Posts: 12
Joined: Sat Aug 26, 2006 12:27 am
Location: Florence (Italy)

Postby James Bott » Wed Aug 30, 2006 1:35 am

Eduardo,

Thanks for the kind words.

Here is an example of how to get the contents of a GET including the last keystroke.

James


Code: Select all  Expand view  RUN
// Testing getting GET buffer including lastkeystroke

#include "fivewin.ch"

function main
   local oDlg,oGet,cTest:=space(10)
   define dialog oDlg
   @ 1,1 get oGet var cTest
   oGet:bChange:={|nKey| oDlg:setText(getData(oGet,nKey)) }
   activate dialog oDlg
return nil


Function getData(oGet,nKey)
   Local cBuffer := oGet:oGet:Buffer
   Local cChar:= if(nKey==VK_BACK,"",chr(nKey))

   if nKey<>VK_RETURN
      cBuffer:= Stuff(cBuffer, oGet:nPos, 1, cChar )
   endif

   // Now cBuffer contains the last char typed

return cBuffer
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 53 guests