Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > C/C++: Общие вопросы > Проблема с TMemo


Автор: valex13 15.3.2004, 12:51
Есть TMemo.
Вношу в него информацию

Memo1->Lines->Add("11");
Memo1->Lines->Add("122");
Memo1->Lines->Add("333");

После показа формы курсор и сролинг установлены в конце. Как мне установить курсор на первую линию?

Автор: Vyacheslav 15.3.2004, 12:54
см. CaretPos

Автор: NiJazz 17.3.2004, 07:37
valex13
Попробуй Memo1->SetFocus().... Только он может выделить весь текст...

Автор: Guest 17.3.2004, 08:06
Memo1->CaretPos=Point(X,Y);
Memo1->SetFocus();

Когда я пробовал у меня вставало на строку,столбец,
а в хедпе написано что в пикселах, так что эксперименируй :-)

Автор: valex13 17.3.2004, 11:55
Не пойму
Метод CaretPos только для чтения
Вот из справки!
__property Windows::TPoint CaretPos = {read=GetCaretPos};
Для Builder 5.0

Автор: gray_k 17.3.2004, 12:22
Можно воспользоваться свойствами SelStart и SelLenght

Автор: valex13 17.3.2004, 13:46
Помогло, спасибо

Автор: Vyacheslav 17.3.2004, 16:17
Indicates the position of the caret in the client area of the memo.

__property TPoint CaretPos = {read=GetCaretPos, write=SetCaretPos};

Description

Use CaretPos to determine the coordinates of the cursor. TPoint type defines a pixel location onscreen, with the origin in the top left corner. X specifies the horizontal coordinate of the point, Y specifies the vertical coordinate. CaretPos indicates the X and Y position relative to the client origin of the memo.

To determine the position of the caret in terms of characters of text only (rather than X/Y location), use the SelStart property.

C++Builder 6

Автор: valex13 19.3.2004, 04:43
Я использую C++Builder5 хотя уже хочу перейти на 6

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)