Фокус Delphi — среда быстрой разработки, где в качестве языка программирования используется Object Pascal. На сегодняшний день позволяет разрабатывать ПО для Microsoft Windows, Mac OS, iOS и Android и входит в состав Embarcadero RAD Studio https://delphi-hlp.ru/index.php/stringgrid/fokus.feed 2022-09-13T04:49:16+07:00 Delphi help info@delphi-hlp.ru Joomla! - Open Source Content Management SetFocus в TStringGrid 2017-08-11T19:33:59+07:00 2017-08-11T19:33:59+07:00 https://delphi-hlp.ru/index.php/stringgrid/fokus/setfocus-v-tstringgrid.html Super User toto44@inbox.ru <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="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 class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Grid.Row := YourRowNumber;</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Grid.TopRow := YourFirstVisibleRow;</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Grid.LeftCol := YourFirstVisibleColumn; </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> </td> </tr> </tbody> </table> </div> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </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="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 class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Grid.Row := YourRowNumber;</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Grid.TopRow := YourFirstVisibleRow;</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Grid.LeftCol := YourFirstVisibleColumn; </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> </td> </tr> </tbody> </table> </div> <p><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> TStringGrid с фокусом (OnDrawCell) 2017-08-11T19:35:09+07:00 2017-08-11T19:35:09+07:00 https://delphi-hlp.ru/index.php/stringgrid/fokus/tstringgrid-s-fokusom-ondrawcell.html Super User toto44@inbox.ru <p style="margin: 7px 0px; text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Если вы создаете собственный обработчик компонента TStringGrid OnDrawCell, то вы можете нарисовать все, что вам заблагорассудится. Попробуйте, к примеру, это:</span></p> <p class="feed-readmore"><a target="_blank" href ="/index.php/stringgrid/fokus/tstringgrid-s-fokusom-ondrawcell.html">Подробнее...</a></p> <p style="margin: 7px 0px; text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Если вы создаете собственный обработчик компонента TStringGrid OnDrawCell, то вы можете нарисовать все, что вам заблагорассудится. Попробуйте, к примеру, это:</span></p> <p class="feed-readmore"><a target="_blank" href ="/index.php/stringgrid/fokus/tstringgrid-s-fokusom-ondrawcell.html">Подробнее...</a></p> Фокус ячейки TStringGrid 2017-08-11T19:34:36+07:00 2017-08-11T19:34:36+07:00 https://delphi-hlp.ru/index.php/stringgrid/fokus/fokus-yachejki-tstringgrid.html Super User toto44@inbox.ru <p style="margin: 7px 0px; text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Автор: Simon</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;"> SetGridFocus(SGrid: TStringGrid; r, c: integer);</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;">var</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> SRect: TGridRect;</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;">with</span><span class="f_CodeExample" style="color: #000000;"> SGrid </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">do</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 style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">    SetFocus; </span><span class="f_CodeExample" style="color: #000080;">{Передаем фокус сетке}</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: #000000;">    Row := r; </span><span class="f_CodeExample" style="color: #000080;">{Устанавливаем Row/Col}</span></span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">    Col := c;</span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">    SRect.Top := r; </span><span class="f_CodeExample" style="color: #000080;">{Определяем выбранную область}</span></span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">    SRect.Left := c;</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">    SRect.Bottom := r;</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">    SRect.Right := c;</span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">    Selection := SRect; </span><span class="f_CodeExample" style="color: #000080;">{Устанавливаем выбор}</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> <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 class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000080; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">//Для вызова процедуры:</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">SetGridFocus(StringGrid1, </span><span class="f_CodeExample" style="color: #800000;">10</span><span class="f_CodeExample" style="color: #000000;">, </span><span class="f_CodeExample" style="color: #800000;">2</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></p> <p style="margin: 7px 0px; text-align: justify;"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">Автор: Simon</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;"> SetGridFocus(SGrid: TStringGrid; r, c: integer);</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;">var</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> SRect: TGridRect;</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;">with</span><span class="f_CodeExample" style="color: #000000;"> SGrid </span><span class="f_CodeExample" style="color: #008000; font-weight: bold;">do</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 style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">    SetFocus; </span><span class="f_CodeExample" style="color: #000080;">{Передаем фокус сетке}</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: #000000;">    Row := r; </span><span class="f_CodeExample" style="color: #000080;">{Устанавливаем Row/Col}</span></span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">    Col := c;</span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">    SRect.Top := r; </span><span class="f_CodeExample" style="color: #000080;">{Определяем выбранную область}</span></span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">    SRect.Left := c;</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">    SRect.Bottom := r;</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">    SRect.Right := c;</span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">    Selection := SRect; </span><span class="f_CodeExample" style="color: #000080;">{Устанавливаем выбор}</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> <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 class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000080; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;">//Для вызова процедуры:</span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span class="f_CodeExample" style="color: #000000; font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"> </span></p> <p class="p_CodeExample"><span style="font-family: tahoma,arial,helvetica,sans-serif; font-size: 12pt;"><span class="f_CodeExample" style="color: #000000;">SetGridFocus(StringGrid1, </span><span class="f_CodeExample" style="color: #800000;">10</span><span class="f_CodeExample" style="color: #000000;">, </span><span class="f_CodeExample" style="color: #800000;">2</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></p>