|
Вопрос # 2 961/ вопрос открыт / |
|
Доброго времени суток, уважаемые эксперты!
подскажите.
есть 3 кнопки, которые выполняют различные функции и форма пустая. необходимо чтобы в форме появлялся текст, который является описанием действия кнопки. как лучше организовать? либо при наведении мышки на кнопку появлялся текст в форме (hint), либо просто текст, через заданные промежутки времени, менялся в форме для каждой кнопки либо может есть еще какие-либо варианты?
 |
Вопрос задал: fedora (статус: Посетитель)
Вопрос отправлен: 1 июля 2009, 19:27
Состояние вопроса: открыт, ответов: 1.
|
Ответ #1. Отвечает эксперт: min@y™
Советую воспользоваться событием Application.OnHint. Имхо, то, что надо.
Положь на форму StaticText или Memo и в обработчике этого событи выводи туда хинт кнопки, над которой находится курсор. В хэлпе, кстати, даже есть примерчик. Цитирую:
{ This shows how the OnHint event handler is declared as a public method of the form }
type
TForm1 = class(TForm)
Button1: TButton;
StatusBar1: TStatusBar;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure DisplayHint(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.xfm}
{ Here is the implementation of the OnHint event handler }
{ It displays the application’s current hint in the status bar }
procedure TForm1.DisplayHint(Sender: TObject);
begin
StatusBar1.SimpleText := GetLongHint(Application.Hint);
end;
{ Here is the form’s OnCreate event handler. }
{ It assign’s the application’s OnHint event handler at runtime }
{ because the Application is not available in the Object Inspector }
{ at design time }
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnHint := DisplayHint;
end;
Приложение: Переключить в обычный режим- Occurs when the mouse pointer moves over a control or menu item that can display a Help Hint.
-
- Delphi syntax:
-
- property OnHint: TNotifyEvent;
-
- C++ syntax:
-
- __property Classes::TNotifyEvent OnHint = {read=FOnHint, write=FOnHint};
-
- Description
-
- Write an OnHint event handler to perform special processing when the mouse pauses over a control or
menu item whose Hint property is not an empty string.
-
- A common use of the OnHint event is to display the value of a control or menu item's Hint property
in another control. Note that it is not necessary to use an OnHint event handler to display hints on
a status bar (TStatusBar): TStatusBar will automatically display hints if you set its AutoHint
property to true.
-
- The Hint property of a control can specify both a short Help Hint and a (usually) longer hint that
appears elsewhere because of code in an OnHint event handler.
-
- Note: You can also respond to this event using the TApplicationEvents component, which allows you to
assign an event handler using the IDE.
-
 |
Ответ отправил: min@y™ (статус: Доктор наук)
Время отправки: 1 июля 2009, 20:27
Оценка за ответ: 5
Комментарий к оценке: подробный ответ и без вопросов.
|
Мини-форум вопроса
Всего сообщений: 2; последнее сообщение — 2 июля 2009, 15:08; участников в обсуждении: 2.
|
Мережников Андрей (статус: Абитуриент), 1 июля 2009, 19:42 [#1]:
чем не удовлетворяет стандартный hint?
|
1 июля 2009, 21:51: Вопрос перемещён из тематического раздела Delphi » Общие вопросы по программированию в раздел Delphi » Работа с компонентами и библиотеками модератором Ерёмин А.А.
|
fedora (статус: Посетитель), 2 июля 2009, 15:08 [#2]:
спасибо. попробую
|
Чтобы оставлять сообщения в мини-форумах, Вы должны авторизироваться на сайте.
|