Реакция компонентов на клавиатуру Delphi — среда быстрой разработки, где в качестве языка программирования используется Object Pascal. На сегодняшний день позволяет разрабатывать ПО для Microsoft Windows, Mac OS, iOS и Android и входит в состав Embarcadero RAD Studio https://delphi-hlp.ru/index.php/reaktsiya-komponentov-na-klaviaturu.feed 2022-09-13T04:28:24+07:00 Delphi help info@delphi-hlp.ru Joomla! - Open Source Content Management Имитация Tab 2017-08-09T17:00:18+07:00 2017-08-09T17:00:18+07:00 https://delphi-hlp.ru/index.php/reaktsiya-komponentov-na-klaviaturu/imitatsiya-tab.html Super User toto44@inbox.ru <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">SelectNext(screen.ActiveControl, True, True);</span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Разместите приведенный код в обработчике одного из собитий. SelectNext - защищенный метод TWinControl со следующим прототипом:</span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <div style="margin: 7px 0px; padding: 0px; text-align: justify; text-indent: 0px;"> <table style="border-width: 1px; border-style: solid; border-color: #000000 #c0c0c0 #c0c0c0 #000000; border-spacing: 0px; background-color: #ffffc4;" border="1" cellspacing="0" cellpadding="5" bgcolor="#ffffc4"> <tbody> <tr align="left" valign="top"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p style="text-align: justify;"><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Code:</span></p> </td> </tr> <tr align="left"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">procedure</span><span class="f_CodeExample" style="color: #000000;"> SelectNext(CurControl: TWinControl; GoForward, CheckTabStop: Boolean);</span></span></p> </td> </tr> </tbody> </table> </div> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> <span style="color: #000000;"> </span></span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Так как форма также является потомком TWinControl, то она имеет доступ к защищенным методам. </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #000000; font-weight: bold;">Взято с </span>https://delphiworld.narod.ru</span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">SelectNext(screen.ActiveControl, True, True);</span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Разместите приведенный код в обработчике одного из собитий. SelectNext - защищенный метод TWinControl со следующим прототипом:</span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <div style="margin: 7px 0px; padding: 0px; text-align: justify; text-indent: 0px;"> <table style="border-width: 1px; border-style: solid; border-color: #000000 #c0c0c0 #c0c0c0 #000000; border-spacing: 0px; background-color: #ffffc4;" border="1" cellspacing="0" cellpadding="5" bgcolor="#ffffc4"> <tbody> <tr align="left" valign="top"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p style="text-align: justify;"><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Code:</span></p> </td> </tr> <tr align="left"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">procedure</span><span class="f_CodeExample" style="color: #000000;"> SelectNext(CurControl: TWinControl; GoForward, CheckTabStop: Boolean);</span></span></p> </td> </tr> </tbody> </table> </div> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> <span style="color: #000000;"> </span></span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Так как форма также является потомком TWinControl, то она имеет доступ к защищенным методам. </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #000000; font-weight: bold;">Взято с </span>https://delphiworld.narod.ru</span></p> Как заблокировать реакцию на клавиатуру компонента? 2017-08-09T16:52:22+07:00 2017-08-09T16:52:22+07:00 https://delphi-hlp.ru/index.php/reaktsiya-komponentov-na-klaviaturu/kak-zablokirovat-reaktsiyu-na-klaviaturu-komponenta.html Super User toto44@inbox.ru <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">В обработчике события onKeyDown попробуй поставить: </span></p> <div style="margin: 7px 0px; padding: 0px; text-align: justify; text-indent: 0px;"> <table style="border-width: 1px; border-style: solid; border-color: #000000 #c0c0c0 #c0c0c0 #000000; border-spacing: 0px; background-color: #ffffc4;" border="1" cellspacing="0" cellpadding="5" bgcolor="#ffffc4"> <tbody> <tr align="left" valign="top"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p style="text-align: justify;"><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Code:</span></p> </td> </tr> <tr align="left"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">Key:=</span><span class="f_CodeExample" style="color: #800000;">0</span><span class="f_CodeExample" style="color: #000000;">; </span></span></p> </td> </tr> </tbody> </table> </div> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p style="text-align: right;"><span style="color: #ff6600; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #ff0000; font-weight: bold;">Автор:</span> <span style="color: #0000ff; font-weight: bold; text-decoration: underline;"><strong>Vit</strong></span></span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #000000; font-weight: bold;">Взято с Vingrad.ru</span> <span style="color: #0000ff; text-decoration: underline;">https://forum.vingrad.ru</span></span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">В обработчике события onKeyDown попробуй поставить: </span></p> <div style="margin: 7px 0px; padding: 0px; text-align: justify; text-indent: 0px;"> <table style="border-width: 1px; border-style: solid; border-color: #000000 #c0c0c0 #c0c0c0 #000000; border-spacing: 0px; background-color: #ffffc4;" border="1" cellspacing="0" cellpadding="5" bgcolor="#ffffc4"> <tbody> <tr align="left" valign="top"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p style="text-align: justify;"><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Code:</span></p> </td> </tr> <tr align="left"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">Key:=</span><span class="f_CodeExample" style="color: #800000;">0</span><span class="f_CodeExample" style="color: #000000;">; </span></span></p> </td> </tr> </tbody> </table> </div> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p style="text-align: right;"><span style="color: #ff6600; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #ff0000; font-weight: bold;">Автор:</span> <span style="color: #0000ff; font-weight: bold; text-decoration: underline;"><strong>Vit</strong></span></span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #000000; font-weight: bold;">Взято с Vingrad.ru</span> <span style="color: #0000ff; text-decoration: underline;">https://forum.vingrad.ru</span></span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> Как работать с ssShift и TShiftState? 2017-08-09T16:58:29+07:00 2017-08-09T16:58:29+07:00 https://delphi-hlp.ru/index.php/reaktsiya-komponentov-na-klaviaturu/kak-rabotat-s-ssshift-i-tshiftstate.html Super User toto44@inbox.ru <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">ssShift - это константа применяемая в типе TShiftState (являущемся типом Set) а не логическая, надо примерно так:</span></p> <div style="margin: 0px; padding: 0px; text-align: left; text-indent: 0px;"> <table style="border-width: 1px; border-style: solid; border-color: #000000 #c0c0c0 #c0c0c0 #000000; border-spacing: 0px; background-color: #ffffc4;" border="1" cellspacing="0" cellpadding="5" bgcolor="#ffffc4"> <tbody> <tr align="left" valign="top"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p style="text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Code:</span></p> </td> </tr> <tr align="left"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">procedure</span><span class="f_CodeExample" style="color: #000000;"> TForm1.FormKeyDown(Sender: TObject; </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">var</span><span class="f_CodeExample" style="color: #000000;"> Key: Word; Shift: TShiftState);</span></span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000080; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">{©Drkb v.3(2007): www.drkb.ru, </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000080; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">®Vit (Vitaly Nevzorov) - <a class="weblink">nevzorov@yahoo.com</a>}</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #008000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">begin</span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;"> if</span><span class="f_CodeExample" style="color: #000000;"> (key=</span><span class="f_CodeExample" style="color: #800000;">$97</span><span class="f_CodeExample" style="color: #000000;">) </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">and</span><span class="f_CodeExample" style="color: #000000;"> (ssShift </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">in</span><span class="f_CodeExample" style="color: #000000;"> Shift) </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">then</span></span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #008000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;"> begin</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000080; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">{do something}</span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;"> end</span><span class="f_CodeExample" style="color: #000000;">;</span></span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">end</span><span class="f_CodeExample" style="color: #000000;">;</span></span></p> </td> </tr> </tbody> </table> </div> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #ff0000; font-weight: bold;">Автор:</span> <span style="color: #0000ff; font-weight: bold; text-decoration: underline;"><strong>Vit</strong></span> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #000000; font-weight: bold;">Взято с Vingrad.ru</span> <span style="color: #0000ff; text-decoration: underline;">https://forum.vingrad.ru</span></span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">ssShift - это константа применяемая в типе TShiftState (являущемся типом Set) а не логическая, надо примерно так:</span></p> <div style="margin: 0px; padding: 0px; text-align: left; text-indent: 0px;"> <table style="border-width: 1px; border-style: solid; border-color: #000000 #c0c0c0 #c0c0c0 #000000; border-spacing: 0px; background-color: #ffffc4;" border="1" cellspacing="0" cellpadding="5" bgcolor="#ffffc4"> <tbody> <tr align="left" valign="top"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p style="text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">Code:</span></p> </td> </tr> <tr align="left"> <td style="border-width: 1px; border-style: solid; border-color: #c0c0c0 #000000 #000000 #c0c0c0;"> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">procedure</span><span class="f_CodeExample" style="color: #000000;"> TForm1.FormKeyDown(Sender: TObject; </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">var</span><span class="f_CodeExample" style="color: #000000;"> Key: Word; Shift: TShiftState);</span></span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000080; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">{©Drkb v.3(2007): www.drkb.ru, </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000080; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">®Vit (Vitaly Nevzorov) - <a class="weblink">nevzorov@yahoo.com</a>}</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #008000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;">begin</span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;"> if</span><span class="f_CodeExample" style="color: #000000;"> (key=</span><span class="f_CodeExample" style="color: #800000;">$97</span><span class="f_CodeExample" style="color: #000000;">) </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">and</span><span class="f_CodeExample" style="color: #000000;"> (ssShift </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">in</span><span class="f_CodeExample" style="color: #000000;"> Shift) </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">then</span></span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #008000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt; font-weight: bold;"> begin</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000080; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">{do something}</span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;"> end</span><span class="f_CodeExample" style="color: #000000;">;</span></span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #008000; font-weight: bold;">end</span><span class="f_CodeExample" style="color: #000000;">;</span></span></p> </td> </tr> </tbody> </table> </div> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #ff0000; font-weight: bold;">Автор:</span> <span style="color: #0000ff; font-weight: bold; text-decoration: underline;"><strong>Vit</strong></span> </span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span style="color: #000000; font-weight: bold;">Взято с Vingrad.ru</span> <span style="color: #0000ff; text-decoration: underline;">https://forum.vingrad.ru</span></span></p> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p><span style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p>