Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ingrid Problem
Message
De
19/07/1998 02:09:37
 
 
À
14/07/1998 23:20:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00116648
Message ID:
00119072
Vues:
26
>>>>>>I am using the Ingrid to provide incremental seach capabilities in a grid. The grid is used strictly to locate records from a single table; no changes to the data are required.
>>>>>>
>>>>>>I have two problems:
>>>>>>1. Whenever 0 (zero), is part of the search string, incremental search seems to turn off and I get a message that the control is read only.
>>>>>>2. Some users have asked that I increase the reset time between keystrokes.
>>>>>>
>>>>>>Any help would be appreicated.
>>>>>>
>>>>>>Alex Shoob
>>>>>
>>>>>Alex,
>>>>>I have modified my copy of Ingrid to take care of these things. Due to the nature, of the changes, I couldn't subclass, but here is what I did.
>>>>>
>>>>>The ingrid control uses _DBLCLICK as its determination of how long to wait before resetting the search string. I simply added one second to that amount by modifying line 11 of the keypress event to look like the following:
>>>>>
>>>>>THIS.cSearchString=IIF(m.nElapsedTime>(_DBLCLICK + 1), ;
>>>>>
>>>>>To handle 0, spacebar, ', and -, I modified line 9 of the same method to read:
>>>>>
>>>>>CASE BETWEEN(m.nKeyCode, 49, 126) OR INLIST(m.nkeycode,32,45,39,48)
>>>>>
>>>>>I hope this helps.
>>>>
>>>>Eric
>>>>
>>>>Thanks for your help. Your code solved the problem as well as a couple of others that I didn't even know I had.
>>>>
>>>>Do you have any thoughts how to exit the incremental search and the grid in which it is in by pressing the ENTER ke? I get "This control is read-only" every time time try to put code in the keypress event of the InGrid control on my grid.
>>>>
>>>>Thanks,
>>>>
>>>>Alex
>>>
>>>Do you mean that you want to quit searching and have the ingrid control like a normal textbox? Or do you just want to jump out of the grid? Or perhaps make the enter key click the default button on the form? THere are ways to do all these, but I should know exactly what you want to do first.
>>
>>Eric
>>
>>I want to jump out of the grid either to another control on the same form or to another form. The best I have come up with so far is to add the following to the Ingrid.vcx keypress event.
>>
>> CASE m.nKeyCode=13
>> if gEnterTerminate
>> thisform.release
>> endif
>>
>>Is there a better way to do this? Are there any side effects from changing the Ingrid control in this manner.
>>
>>Thanks for all your help and interest,
>>
>>Alex Shoob
>
>Instead of specifying the action explicitly, you might want to create a new method in the class called ActiononEnter or something and call that method in your CASE statement. That way you can put whatever code you want in that method in different instances of the class, and not have to modify the again class later. Polymorphism in action.

Eric

Thanks for all your help. I really appreciate it.

I have one remaining question and one more InGrid problem. First the question. Someone (It think it was Dragan Nedeljkovic), in this thread indicated that the InGrid keypress method should use isalpha rather than the range of characters currently specified. Does this mean that the code should read
CASE isalpha((m.nKeyCode)
rather than
CASE BETWEEN(m.nKeyCode, 49, 126) OR INLIST(m.nkeycode,32,45,39,48) && AlphaNumeric

Now the problem. My grid has three columns with InGrid text boxes. The user can click on the column header to set the index. I would like the record pointer to remain on the current record when this is done. My code is as follows:

thisform.grid1.column2.header1.forecolor = RGB(128,0,0)
thisform.grid1.column2.header1.fontBold = .t.
thisform.grid1.column3.header1.forecolor = RGB(0,0,0)
thisform.grid1.column3.header1.fontBold = .f.
thisform.grid1.column4.header1.forecolor = RGB(0,0,0)
thisform.grid1.column4.header1.fontBold = .f.
thisform.grid1.column2.ingrid2.setfocus
WAIT WINDOW '' TIMEOUT .01 &&& from an earlier InGrid problem thread
cur_rec = recno()
set order to shotorder
pe_index = shotorder
go cur_rec
thisform.refresh

For whatever reason, this code fails. The record pointer moves (consistently) to another record. There was an earlier InGrid thread in which it was indicated that there was some side effect in InGrid of clicking in the column header. Any thoughts on this.

Alex
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform