Board index » cppbuilder » How to "control" key Tab from keyboard
Jimakos Bilakis
![]() CBuilder Developer |
How to "control" key Tab from keyboard2006-03-11 05:21:24 AM cppbuilder114 Hi guys, i'm totally new in BCB6 and i need some help here! In my project's form i have several Edit boxes, DBEdit boxes, a Data source and a DBGrid. In a data module now i have a table and several queries. I have made my project to store the values which i pass through the edit boxes to my table (at run time). I even found a way to change the already stored values in the table with some help from the DBEdits but there is a serious problem (again at run time). The values that i pass are checked from an error function that i created and i placed it OnKeyPress Event of each DBEdit box (if Key == 13....// then do the check for duplicate values). All works fine when i press enter (at run time). The problem starts if I press Tab to pass from one DBEdit to another (at run time). The values I write, pass to the table without any warning for duplicate values!!! I tryied all the numbers (0 to 32) from the table ASCII in the OnKeyPress function (the code i wrote is if ((Key == 13)||(Key == X) where X = 1...32), but nothing seems to work. By pressing the Tab key, it happens the following: Project runs .... DBEdit1->SetFocus()....Then i press Tab From DBEdit1->Text it goes to DBEdit2->Text, From DBEdit2->Text it goes to DBEdit3->Text, From DBEdit3->Text it goes to the last record of the table in DBGrid!!! In OnKeyPress Event for DBEdit4 i wrote : if ((Key == 13) || (Key == 9)) DBEdit1->SetFocus(); Is it or is it not the number 9 the decimal number of Horizontal Tab in ASCII Table??? I even tried with the OnKeyDown Event where i wrote: if (Key == VK_TAB) DBEDit1->SetFocus(); but nothing changed!!! How can i take control of the key Tab? Thanks for your time!!! |