auto complete feature

auto complete feature

Postby Ehab Samir Aziz » Wed Apr 18, 2007 5:23 pm

The auto complete feature in any internet for getting a variable . I need it in Xbrowse edititing. Is there auto complete for get class ?
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Antonio Linares » Thu Apr 19, 2007 12:18 pm

Ehab,

What text should be used to auto complete a Get ?
regards, saludos

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

Postby Ehab Samir Aziz » Wed Apr 25, 2007 9:23 am

for example if I will get data from field can the auto complete works . For instance if I pressed letter A I will get all data that begins with A and etc..
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby Maurilio Viana » Wed Apr 25, 2007 11:27 am

Ehab and Antonio,

I use this class I created: TAutoGet
New features, bug fixes and enhancements are welcome :-)

Code: Select all  Expand view
// TAutoGet.prg
// Auto complete text in get features
// By: Maurilio Viana mouri_ryo@hotmail.com
//
// New features, bug fixes and enhancements are welcome :-)
// Please, let me now when you include new features, bug fixes etc in this class
//
// ToDo: Show drop down window with possible options when typing
//

#include "fivewin.ch"

CLASS TAutoGet FROM TGet
   DATA aItems AS ARRAY

   METHOD New( nRow    , nCol    , bSetGet  , oWnd     , nWidth   , nHeight,;
               cPict   , bValid  , nClrFore , nClrBack , oFont    , lDesign,;
               oCursor , lPixel  , cMsg     , lUpdate  , bWhen    , lCenter,;
               lRight  , bChanged, lReadOnly, lPassword, lNoBorder, nHelpID,;
               lSpinner, bUp     , bDown    , bMin     , bMax     , aItems  ) CONSTRUCTOR

   METHOD ReDefine( nID     , bSetGet , oWnd     , nHelpId , cPict, bValid ,;
                    nClrFore, nClrBack, oFont    , oCursor , cMsg , lUpdate,;
                    bWhen   , bChanged, lReadOnly, lSpinner, bUp  , bDown  ,;
                    bMin    , bMax, aItems ) CONSTRUCTOR
   METHOD SetItems( aItems )
   METHOD AutoFill()
END CLASS


//-----------------------------------------------------------------------------------------
METHOD New(nRow     , nCol     , bSetGet , oWnd    , nWidth , nHeight , cPict    ,;
           bValid   , nClrFore , nClrBack, oFont   , lDesign, oCursor , lPixel   ,;
           cMsg     , lUpdate  , bWhen   , lCenter , lRight , bChanged, lReadOnly,;
           lPassword, lNoBorder, nHelpId , lSpinner, bUp    , bDown   , bMin     ,;
           bMax     , aItems) CLASS TAutoGet
local nLen, i

Super:New(nRow   , nCol    , bSetGet  , oWnd     , nWidth   , nHeight,;
           cPict  , bValid  , nClrFore , nClrBack , oFont    , lDesign,;
           oCursor, lPixel  , cMsg     , lUpdate  , bWhen    , lCenter,;
           lRight , ::bChange, lReadOnly, lPassword, lNoBorder, nHelpId,;
           lSpinner, bUp    , bDown    , bMin     , bMax )

if(aItems == Nil, aItems := {}, )

::aItems := aItems

::bPostKey := {|oGet, cBuffer| ::AutoFill() }
return( Self )

//-----------------------------------------------------------------------------------------
METHOD ReDefine(nID      , bSetGet , oWnd   , nHelpId, cPict  , bValid, nClrFore,;
                nClrBack , oFont   , oCursor, cMsg   , lUpdate, bWhen , bChanged,;
                lReadOnly, lSpinner, bUp    , bDown  , bMin   , bMax  , aItems ) CLASS TAutoGet

Super:ReDefine(nID      , bSetGet , oWnd   , nHelpId, cPict  , bValid, nClrFore ,;
                nClrBack , oFont   , oCursor, cMsg   , lUpdate, bWhen , ::bChange,;
                lReadOnly, lSpinner, bUp    , bDown  , bMin   , bMax  , aItems  )


if(aItems == Nil, aItems := {}, )

::aItems   := aItems

::bPostKey := {|oGet, cBuffer| ::AutoFill() }
return( Self )

//---------------------------------------------------------------------------------------
// Set items of AutoGet
//---------------------------------------------------------------------------------------
METHOD SetItems( aItems ) CLASS TAutoGet
if(aItems == Nil, aItems := {}, )

::aItems   := aItems

return( Nil )

//---------------------------------------------------------------------------------------
// Auto fill text when type based on aItems options
// Return: Ever return .T.
//---------------------------------------------------------------------------------------
METHOD AutoFill() CLASS TAutoGet
local nPosItem   := 0                           // Text position into ::aItems
local nPosCursor := ::nPos                      // Current cursor position
local nLenght    := len(::cText)                // Text lenght
local cStartTxt  := left(::cText, nPosCursor-1) // Start text (position 1 to cursor position -1)
local cItem

if len(::aItems) = 0      // We have no items to search in this GET
    return(.T.)
endif

//-------------------------------------------------------------------------
// We use ::cargo to control when we must search in ::aItems for typed text
// We must seek in ::aItems when GET is blank or when user clear it
//-------------------------------------------------------------------------
if valtype(::Cargo) != "L" // Cargo isn't logical yet -> GET received focus now
    if ! empty(::Value)     // GET isn't empty
       ::Cargo := .F.       // We don't use autofill
    else                    // GET is empty
       ::Cargo := .T.       // Use autofill
    endif
else                       // We are controlling if use or no autofill
    if empty(::Value)       // User could cleaned the GET text
       ::Cargo := .T.       // Use autofill
    endif
endif
//-------------------------------------------------------------------------
// When lost focus we clean ::Cargo and set GET cursor position to 1st pos
//-------------------------------------------------------------------------
::bLostFocus := {|| ::SetPos(1), ::Cargo := Nil }

if ! ::Cargo    // If don't control autofill
    return(.t.)
endif

nKey := ::nLastKey
do case
    case nKey ==  9 .or. ;    // Tab key
         nKey == 13 .or. ;    // Enter key
         nKey == 46           // Del key
         ::Assign()           // Assign typed text
    case nKey > 31
         FOR EACH cItem IN ::aItems
             nPosItem += 1
             if ToUpper( cItem ) = ToUpper(cStartTxt)
                nLenght := len( rtrim( cItem ) )
                cItem   += space( nLenght - len(cItem) )
                ::SetText( cItem )
                ::SetSel( nPosCursor -1, nLenght) // Select found text
                return(.t.)
             endif
         NEXT
         ::HideSel()   // Text not found -> Undo selected text
endcase
return( .T. )

// Convert latin characters to ANSI upper case
// (for any reason AnsiUpper cause a GPF with Comercial xHB)

STATIC function ToUpper( cString )
cString := upper( cString )
cString := strtran(strtran(strtran(strtran(cString,"á","Á"),"à","À"),"ã","Ã"),"â","Â")
cString := strtran(strtran(cString,"é","É"),"ê","Ê")
cString := strtran(cString,"í","Í")
cString := strtran(strtran(strtran(cString,"ó","Ó"),"õ","Õ"),"ô","Ô")
cString := strtran(strtran(strtran(cString,"ú","Ú"),"ñ","Ñ"),"ç","Ç")
return( cString )

// --- EoF ---


xBase definition (AutoGet.ch):
Code: Select all  Expand view
/*----------------------------------------------------------------------------//
!short: AUTOGET  */

#xcommand REDEFINE AUTOGET [ <oGet> VAR ] <uVar> ;
             [ ID <nId> ] ;
             [ <dlg: OF, WINDOW, DIALOG> <oDlg> ] ;
             [ <help:HELPID, HELP ID> <nHelpId> ] ;
             [ VALID   <ValidFunc> ]       ;
             [ <pict: PICTURE, PICT> <cPict> ] ;
             [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
             [ FONT <oFont> ] ;
             [ CURSOR <oCursor> ] ;
             [ MESSAGE <cMsg> ] ;
             [ <update: UPDATE> ] ;
             [ WHEN <uWhen> ] ;
             [ ON CHANGE <uChange> ] ;
             [ <readonly: READONLY, NO MODIFY> ] ;
             [ <spin: SPINNER> [ON UP <SpnUp>] [ON DOWN <SpnDn>] [MIN <Min>] [MAX <Max>] ] ;
             [ ITEMS <aItems>] ;
       => ;
          [ <oGet> := ] TAutoGet():ReDefine( <nId>, bSETGET(<uVar>), <oDlg>,;
             <nHelpId>, <cPict>, <{ValidFunc}>, <nClrFore>, <nClrBack>,;
             <oFont>, <oCursor>, <cMsg>, .T., <{uWhen}>,;
             [ \{|nKey,nFlags,Self| <uChange> \}], <.readonly.>,;
             <.spin.>, <{SpnUp}>, <{SpnDn}>, <{Min}>, <{Max}>, <aItems>)

#command @ <nRow>, <nCol> AUTOGET [ <oGet> VAR ] <uVar> ;
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
            [ <pict: PICTURE, PICT> <cPict> ] ;
            [ VALID <ValidFunc> ] ;
            [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
            [ SIZE <nWidth>, <nHeight> ]  ;
            [ FONT <oFont> ] ;
            [ <design: DESIGN> ] ;
            [ CURSOR <oCursor> ] ;
            [ <pixel: PIXEL> ] ;
            [ MESSAGE <cMsg> ] ;
            [ <update: UPDATE> ] ;
            [ WHEN <uWhen> ] ;
            [ <lCenter: CENTER, CENTERED> ] ;
            [ <lRight: RIGHT> ] ;
            [ ON CHANGE <uChange> ] ;
            [ <readonly: READONLY, NO MODIFY> ] ;
            [ <pass: PASSWORD> ] ;
            [ <lNoBorder: NO BORDER, NOBORDER> ] ;
            [ <help:HELPID, HELP ID> <nHelpId> ] ;
            [ ITEMS <aItems>] ;
       => ;
          [ <oGet> := ] TAutoGet():New( <nRow>, <nCol>, bSETGET(<uVar>),;
             [<oWnd>], <nWidth>, <nHeight>, <cPict>, <{ValidFunc}>,;
             <nClrFore>, <nClrBack>, <oFont>, <.design.>,;
             <oCursor>, <.pixel.>, <cMsg>, .T., <{uWhen}>,;
             <.lCenter.>, <.lRight.>,;
             [\{|nKey, nFlags, Self| <uChange>\}], <.readonly.>,;
             <.pass.>, [<.lNoBorder.>], <nHelpId>,,,,,,<aItems> )

#command @ <nRow>, <nCol> AUTOGET [ <oGet> VAR ] <uVar> ;
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
            [ <pict: PICTURE, PICT> <cPict> ] ;
            [ VALID <ValidFunc> ] ;
            [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
            [ SIZE <nWidth>, <nHeight> ]  ;
            [ FONT <oFont> ] ;
            [ <design: DESIGN> ] ;
            [ CURSOR <oCursor> ] ;
            [ <pixel: PIXEL> ] ;
            [ MESSAGE <cMsg> ] ;
            [ <update: UPDATE> ] ;
            [ WHEN <uWhen> ] ;
            [ <lCenter: CENTER, CENTERED> ] ;
            [ <lRight: RIGHT> ] ;
            [ ON CHANGE <uChange> ] ;
            [ <readonly: READONLY, NO MODIFY> ] ;
            [ <help:HELPID, HELP ID> <nHelpId> ] ;
            [ <spin: SPINNER> [ON UP <SpnUp>] [ON DOWN <SpnDn>] [MIN <Min>] [MAX <Max>] ] ;
            [ ITEMS <aItems>] ;
       => ;
          [ <oGet> := ] TAutoGet():New( <nRow>, <nCol>, bSETGET(<uVar>),;
             [<oWnd>], <nWidth>, <nHeight>, <cPict>, <{ValidFunc}>,;
             <nClrFore>, <nClrBack>, <oFont>, <.design.>,;
             <oCursor>, <.pixel.>, <cMsg>, .T., <{uWhen}>,;
             <.lCenter.>, <.lRight.>,;
             [\{|nKey, nFlags, Self| <uChange>\}], <.readonly.>,;
             .f., .f., <nHelpId>,;
             <.spin.>, <{SpnUp}>, <{SpnDn}>, <{Min}>, <{Max}>, <aItems> )


A fragment of code:

#include "autoget.ch"

(...)
cName := space(20)
aNames := {"Mauro", "Mauricio", "Maurilio", "Maurizio"}

redefine autoget oGet var cName id 101 of oDlg items aNames

(...)
You can update items from available text to autocomplete using:
aNames := {"Angelo", "Antonio", "Afonso"}
oGet:SetItems( aNames )

Best regards!
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby James Bott » Wed Apr 25, 2007 7:18 pm

Maurilio,

Good work. I like it.

I have made a few changes (see comments in code).

AutoFill (or autocomplete) is somewhat of a Pandora's box. If you look at Outlook Express's "To" field and IE's "Address" field you will see two completely different methods of autocomplete. OE uses some kind of probability rather than the first alpha match. I have several Davids in my address book, but the one I use the most is near the end of the alpha sort of Davids. However, all I have to do is type "D" and his name shows up.

In contrast, IE has a drop-down list that is alpha order--not listed by probability.

Things get even more complicated with multi-user applications. Do we store all items entered by all users or do we separate out items by user? Each circumstance may require a different solution.

Do we use arrays, or direct database lookups? Arrays are good if they are small, but what about large arrays of say 10,000 items? Do we read them from a DBF each time the dialog is opened, or store them in a static array? A static would be faster but will use up a lot of memory, so perhaps a direct database lookup would be better with large lists.

Do we do alpha lookups or probability lookups? Again, each situation may require a different solution.

How do we handle adding new items and when? Do we add all new items entered by any user? Only the most used?

So, there is no simple answer to providing autocomplete functionality. But autocomplete solutions are very helpful to the user so they are certainly worth working on.

James

Code: Select all  Expand view
// TAutoGet.prg
// Auto complete text in get features
// By: Maurilio Viana, mouri_ryo@hotmail.com
// Date: 4/25/2007
// New features, bug fixes and enhancements are welcome :-)
// Please, let me now when you include new features, bug fixes etc in this class
//
// ToDo: Show drop down window with possible options when typing
//

/* Revisions 4/25/2007 10:49AM by James Bott
Method AutoFill: nKey was not defined as a LOCAL. Fixed.
Method AutoFill: nLength was mispelled (as nLenght). Fixed.
Method AutoFill: ::Cargo changed to ::lAuto (see reason below)
Method AutoFill: Changed to using vkey.ch manifest constants instead of numbers.
Method Redefine: Was passing aItems to the parent method (not needed).
Method LostFocus: Added this method.
Methos New() and Redefine(). Was passing bChanged, and then ::bChange to parent. Fixed.

It is not a good idea to use ::Cargo, ::bPostKey, or ::bLostFocus in the class since these
then cannot be used by the programmer. It would be better to subclass the needed methods and add
whatever functionality needed. So, ::Cargo and ::bLostFocus were eliminated.

Unfortuneately, not using ::bPostKey is somewhat of a challenge. We can subclass KeyDown() and
KeyChar() but some of each method will have to be copied into the new methods and thus if there
are any changes to these sections of code in future versions of TGET, then this method in
TAutoGet will have to be updated also.

Bug?: If the items in ::aArray are in proper case, e.g. "Mauro," they are automatically converted
to proper case when autofilled, however, if you backspace they are converted to all lower case.

*/

#include "fivewin.ch"

//---------------------------------------------------------------------------//

CLASS TAutoGet FROM TGet
   DATA aItems AS ARRAY
   DATA lAuto AS LOGICAL

   METHOD New( nRow    , nCol    , bSetGet  , oWnd     , nWidth   , nHeight,;
               cPict   , bValid  , nClrFore , nClrBack , oFont    , lDesign,;
               oCursor , lPixel  , cMsg     , lUpdate  , bWhen    , lCenter,;
               lRight  , bChanged, lReadOnly, lPassword, lNoBorder, nHelpID,;
               lSpinner, bUp     , bDown    , bMin     , bMax     , aItems  ) CONSTRUCTOR

   METHOD ReDefine( nID     , bSetGet , oWnd     , nHelpId , cPict, bValid ,;
                    nClrFore, nClrBack, oFont    , oCursor , cMsg , lUpdate,;
                    bWhen   , bChanged, lReadOnly, lSpinner, bUp  , bDown  ,;
                    bMin    , bMax, aItems ) CONSTRUCTOR
   METHOD SetItems( aItems )
   METHOD AutoFill()
   METHOD LostFocus( hWndGetFocus ) inline ::SetPos(1), ::lAuto := Nil, ::super:LostFocus( hWndGetFocus )
END CLASS

//---------------------------------------------------------------------------//

METHOD New(nRow     , nCol     , bSetGet , oWnd    , nWidth , nHeight , cPict    ,;
           bValid   , nClrFore , nClrBack, oFont   , lDesign, oCursor , lPixel   ,;
           cMsg     , lUpdate  , bWhen   , lCenter , lRight , bChanged, lReadOnly,;
           lPassword, lNoBorder, nHelpId , lSpinner, bUp    , bDown   , bMin     ,;
           bMax     , aItems) CLASS TAutoGet
   local nLen, i

   Super:New(nRow   , nCol    , bSetGet  , oWnd     , nWidth   , nHeight,;
           cPict  , bValid  , nClrFore , nClrBack , oFont    , lDesign,;
           oCursor, lPixel  , cMsg     , lUpdate  , bWhen    , lCenter,;
           lRight , bChanged, lReadOnly, lPassword, lNoBorder, nHelpId,;
           lSpinner, bUp    , bDown    , bMin     , bMax )

   if(aItems == Nil, aItems := {}, )

   ::aItems := aItems

   ::bPostKey := {|oGet, cBuffer| ::AutoFill() }

return( Self )

//---------------------------------------------------------------------------//

METHOD ReDefine(nID      , bSetGet , oWnd   , nHelpId, cPict  , bValid, nClrFore,;
                nClrBack , oFont   , oCursor, cMsg   , lUpdate, bWhen , bChanged,;
                lReadOnly, lSpinner, bUp    , bDown  , bMin   , bMax  , aItems ) CLASS TAutoGet

   Super:ReDefine(nID      , bSetGet , oWnd   , nHelpId, cPict  , bValid, nClrFore ,;
                nClrBack , oFont   , oCursor, cMsg   , lUpdate, bWhen , bChanged,;
                lReadOnly, lSpinner, bUp    , bDown  , bMin   , bMax  )


   if(aItems == Nil, aItems := {}, )

   ::aItems   := aItems

   ::bPostKey := {|oGet, cBuffer| ::AutoFill() }

return( Self )

//---------------------------------------------------------------------------//
// Set items of AutoGet
//---------------------------------------------------------------------------//

METHOD SetItems( aItems ) CLASS TAutoGet
   if(aItems == Nil, aItems := {}, )
   ::aItems   := aItems
return( Nil )

//---------------------------------------------------------------------------//
// Auto fill text when typed based on aItems
// Return: Always returns .T.
//---------------------------------------------------------------------------//

METHOD AutoFill() CLASS TAutoGet
   local nPosItem   := 0                           // Text position into ::aItems
   local nPosCursor := ::nPos                      // Current cursor position
   local nLength    := len(::cText)                // Text length
   local cStartTxt  := left(::cText, nPosCursor-1) // Start text (position 1 to cursor position -1)
   local cItem      := ""
   local nKey       := 0

   if len(::aItems) = 0      // We have no items to search in this GET
      return(.T.)
   endif

   //-------------------------------------------------------------------------
   // We use ::lAuto to control when we must search in ::aItems for typed text
   // We must seek in ::aItems when GET is blank or when user clear it
   //-------------------------------------------------------------------------
   if valtype(::lAuto) != "L" // Cargo isn't logical yet -> GET received focus now
      if ! empty(::Value)     // GET isn't empty
         ::lAuto := .F.       // We don't use autofill
      else                    // GET is empty
         ::lAuto := .T.       // Use autofill
      endif
   else                       // We are controlling if use or no autofill
      if empty(::Value)       // User could cleaned the GET text
         ::lAuto := .T.       // Use autofill
      endif
   endif

   if ! ::lAuto    // If don't control autofill
      return(.t.)
   endif

   nKey := ::nLastKey
   do case
      case nKey == VK_TAB .or. ;
         nKey == VK_RETURN .or. ;
         nKey == VK_DELETE
         ::Assign()           // Assign typed text
      case nKey >= 32 .and. <= 256
         FOR EACH cItem IN ::aItems
            nPosItem += 1
            if ToUpper( cItem ) = ToUpper(cStartTxt)
               nLength := len( rtrim( cItem ) )
               cItem   += space( nLength - len(cItem) )
               ::SetText( cItem )
               ::SetSel( nPosCursor -1, nLength) // Select found text
               return(.t.)
            endif
         NEXT
         ::HideSel()   // Text not found -> Undo selected text
   endcase
return( .T. )

//---------------------------------------------------------------------------//
// Convert latin characters to ANSI upper case
// (for some reason AnsiUpper causes a GPF with Commercial xHB)
//---------------------------------------------------------------------------//

STATIC function ToUpper( cString )
   cString := upper( cString )
   cString := strtran(strtran(strtran(strtran(cString,"á","Á"),"à","À"),"ã","Ã"),"â","Â")
   cString := strtran(strtran(cString,"é","É"),"ê","Ê")
   cString := strtran(cString,"í","Í")
   cString := strtran(strtran(strtran(cString,"ó","Ó"),"õ","Õ"),"ô","Ô")
   cString := strtran(strtran(strtran(cString,"ú","Ú"),"ñ","Ñ"),"ç","Ç")
return( cString )

//---------------------------------------------------------------------------//

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

Postby Maurilio Viana » Wed Apr 25, 2007 8:37 pm

Thanks a lot, James!!!
Very good suggestions and fixes!

About:
>>Bug?: If the items in ::aArray are in proper case, e.g. "Mauro," they are >>automatically converted
>>to proper case when autofilled, however, if you backspace they are >>converted to all lower case.

The true is that I don't know what do in this case... :-(

Best regards and thanks again!!!
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby AOKISANTOS » Fri Apr 27, 2007 1:27 am

Maurilio, que erro é este? :cry:

xHarbour Compiler build 0.99.71 (SimpLex)
Copyright 1999-2006, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'C:\genesis\tautoget.prg'...
C:\genesis\tautoget.prg(138) Error E0030 Syntax error: "parse error at '32'"
C:\genesis\tautoget.prg(150) Error E0017 Unclosed control structure at line 135
2 errors

No code generated
FWH25+XHARBOUR 99.50
AOKISANTOS
 
Posts: 210
Joined: Sun Jul 23, 2006 1:15 am

Postby ssbbs » Fri Apr 27, 2007 2:27 am

AOKISANTOS wrote:Maurilio, que erro é este? :cry:

xHarbour Compiler build 0.99.71 (SimpLex)
Copyright 1999-2006, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'C:\genesis\tautoget.prg'...
C:\genesis\tautoget.prg(138) Error E0030 Syntax error: "parse error at '32'"
C:\genesis\tautoget.prg(150) Error E0017 Unclosed control structure at line 135
2 errors

No code generated


old: case nKey >= 32 .and. <= 256
change to -> case nKey >= 32 .and. nKey <= 256
User avatar
ssbbs
 
Posts: 104
Joined: Mon Oct 17, 2005 3:03 am
Location: Taiwan

Postby ssbbs » Fri Apr 27, 2007 3:37 am

bug fix:
Code: Select all  Expand view
      Case nKey >= 32 .And. nKey <= 256
         :
         :
               ::SetText( cItem )
               ::SetSel( nPosCursor -1, nLength) // Select found text
               ::oGet:Buffer = Pad( cItem, Len( ::oGet:Buffer )) // add by:ss-bbs
               return(.t.)
            endif
         NEXT



bug: press 'M' -> VK_RIGHT -> 'S' -> 'A'
data is 'M SA'
User avatar
ssbbs
 
Posts: 104
Joined: Mon Oct 17, 2005 3:03 am
Location: Taiwan

Postby Maurilio Viana » Fri Apr 27, 2007 11:18 am

Many thanks, ssbbs!

Regards,
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil

Postby Ehab Samir Aziz » Fri Apr 27, 2007 5:49 pm

can you guide me how to use it to get a value from field without using resources from code please ?
What is written inside autoget.ch Could you send it to me ?
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby James Bott » Fri Apr 27, 2007 6:01 pm

Ehab,

>can you guide me how to use it to get a value from field without using resources from code please ?

Code: Select all  Expand view
#include "fivewin.ch"
#include "autoget.ch"

function main()
   local oDlg, oGet, cName, aNames

   cName := space(20)
   aNames := {"Mauro", "Mauricio", "Maurilio", "Maurizio"}

   define dialog oDlg title "Test Autoget"

   @ 2,2 autoget oGet var cName of oDlg items aNames

   activate dialog oDlg centered

return nil


>What is written inside autoget.ch Could you send it to me ?

The autoget.ch file was posted in the original message just after the PRG code (in a message above in this thread).
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Ehab Samir Aziz » Fri Apr 27, 2007 7:40 pm

┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for Harbour 7.01 - January 2007 Harbour development power │
│ (c) FiveTech, 1993-2006 for Microsoft Windows 95/98/NT/2000/ME and XP
 
Compiling...
Harbour Alpha build 1.0 Intl.
Copyright 1999-2007, http://www.harbour-project.org/
Compiling 'autoget.prg' and generating preprocessed output to 'autoget.ppo'...
autoget.prg(42) Error E0030 Syntax error: "syntax error at '@'"
1 error

No code generated
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
autoget.c:
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
* Application successfully built

E:\programs\Database\clipper\clpfwh\sitex>
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Postby James Bott » Fri Apr 27, 2007 8:15 pm

Ehab,

There is no @ symbol in autoget.prg.

Did you paste the sample code into it? If so, then you need to include "autoget.ch."

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

Postby Ehab Samir Aziz » Sat Apr 28, 2007 10:39 am

Oka I got it but that was not my goal . My goal was to open combobox with all values matched with the first letter and I can choose any one ??
Last edited by Ehab Samir Aziz on Sun Jul 08, 2007 8:59 am, edited 2 times in total.
Ehab Samir Aziz
 
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 25 guests