searching in combobox, please , somebody can help me ?

Moderator: Rathinagiri

User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: searching in combobox, please , somebody can help me ?

Post by esgici »

gdp wrote: Sorry, Esgici, was the emotion .....
...
And Now, this was the solution that i found . . . .
OK amigo, no problem :arrow:

Happy HMG :D
Viva INTERNATIONAL HMG :D
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: searching in combobox, please , somebody can help me ?

Post by franco »

Hi, all ........... I am new and do not know if this is how to respond but here goes.
I spent 2 to 3 weeks on this problem. I have solve the problem for me.
I found all the other solutions do not seem to work smoothly with large tables, this does.
I found i had to change to change 3.15 so I could use getlastcharacter. Maybe this will
work for you in your program and 3.0**. This is complete program that creates the table and runs.
hope this will help or give you some ideas ........ Franco

Code: Select all

 #include "hmg.ch"	  

  PROC Main()
      private MN
      MN := {}
      OP()
      GO TOP                // create array no index
      do while ! eof()
         aADD(mn, INV->NUM1 )
         SKIP
         LOOP
      ENDDO 
      GO TOP
 
    DEFINE WINDOW form_1 ;
            AT 0,0 ;
            WIDTH 650 ;
            HEIGHT 400;
            TITLE 'CSBox ( Combined Search Box ) Test' ;
            MAIN           
     
     @ 35, 010 textbox text_1 ;
            width 100 ;
            field inv->num1 ;
            READONLY 
 
         @ 35, 132 textbox text_2 ;
            width 100 
            tooltip 'Press Escape to Exit'

            define combobox s1
            row 35
            col 111
            width 20
            TABSTOP .F.
            backcolor {0,0,255}
            ITEMS MN
            DROPPEDWIDTH 300
            DISPLAYEDIT .T.
            ONDISPLAYCHANGE nt()
            ONCLOSEUP NT1()
            ON GOTFOCUS GF()
            ONLOSTFOCUS FORM_1.text_2.visible := .F.
            tooltip 'Press Escape to Exit'
          end combobox
            
       
      END WINDOW // frmCSBTest
          form_1.text_2.visible := .f.
          form_1.Center
          form_1.activate
 
   FUNCTION GF
    FORM_1.TEXT_2.VALUE := ''
    FORM_1.TEXT_2.VISIBLE := .T.
   RETURN  
 
   FUNCTION NT
      SELECT inv 
      FORM_1.TEXT_2.VALUE :=  FORM_1.S1.DISPLAYVALUE
   RETURN

   FUNCTION NT1
      LOCAL LAS := inv->NUM1
      IF ASC(HMG_GETLASTCHARACTER()) = 27
         SEEK LAS
         form_1.text_2.value := ''
         FORM_1.TEXT_1.REFRESH
         FORM_1.TEXT_1.SETFOCUS
         RETURN
      ENDIF      
      IF form_1.s1.value = 0
          SEEK FORM_1.S1.DISPLAYVALUE
          form_1.text_2.value :=  FORM_1.S1.DISPLAYVALUE
         IF EOF()
           SEEK LAS
           MSGBOX(FORM_1.S1.DISPLAYVALUE+ ' Not Found')
         ENDIF  
      ELSE  
          SEEK mn[FORM_1.S1.VALUE]
      ENDIF
      form_1.text_2.value := ''
      FORM_1.TEXT_1.REFRESH
      FORM_1.TEXT_1.SETFOCUS
      FORM_1.S1.VALUE := 1
   RETURN
    
     FUNCTION op
      LOCAL CF :={}
                                      
     if ! file('inv.dbf')
         CF := {}
         aADD(CF,{'NUM1'       ,'C' , 15,0})
         aADD(CF,{'DESC'       ,'C' , 15,0})
         DBCREATE( 'inv.dbf',CF )
         USE
         use inv new
         index on num1 to num1
        set index to num1
        do while recno() < 40000
           append blank
           replace num1 with alltrim(str(10000+recno()))
           replace desc with 'D' +alltrim(str(10000+recno()))
           loop
       enddo
       close inv
    endif
    use inv shared new
    set index to num1     
    return
All The Best,
Franco
Canada
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: searching in combobox, please , somebody can help me ?

Post by esgici »

franco wrote:...This is complete program that creates the table and runs.
hope this will help or give you some ideas ...
In contrary to minimized identifiers,
I like self contained samples :arrow:

Thank to share :)

Viva HMG :D
Viva INTERNATIONAL HMG :D
User avatar
tonton2
Posts: 444
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: searching in combobox, please , somebody can help me ?

Post by tonton2 »

Merci Franco pour le partage
je vais essayer de le developper dans une grille

Franco thank you for sharing
I'll try to develop it in a grid :idea:

Salamalaykoum Mr Esgici
L'Algerie vous salut
Y.TABET
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: searching in combobox, please , somebody can help me ?

Post by esgici »

tonton2 wrote: Salamalaykoum Mr Esgici
Alayna ve alaykoum Salam yâ Âhi :D
Viva INTERNATIONAL HMG :D
Post Reply