Экспертная система Delphi.int.ru

Сообщество программистов
Общение, помощь, обмен опытом

Логин:
Пароль:
Регистрация | Забыли пароль?

Delphi.int.ru Expert

Другие разделы портала

Переход к вопросу:

#   

Статистика за сегодня:  


Лучшие эксперты

Подробнее »



Вопрос # 2 961

/ вопрос открыт /

Доброго времени суток, уважаемые эксперты!
подскажите.
есть 3 кнопки, которые выполняют различные функции и форма пустая. необходимо чтобы в форме появлялся текст, который является описанием действия кнопки. как лучше организовать? либо при наведении мышки на кнопку появлялся текст в форме (hint), либо просто текст, через заданные промежутки времени, менялся в форме для каждой кнопки либо может есть еще какие-либо варианты?

fedora Вопрос ожидает решения (принимаются ответы, доступен мини-форум)

Вопрос задал: 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;

Приложение:
  1. Occurs when the mouse pointer moves over a control or menu item that can display a Help Hint.
  2.  
  3. Delphi syntax:
  4.  
  5. property OnHint: TNotifyEvent;
  6.  
  7. C++ syntax:
  8.  
  9. __property Classes::TNotifyEvent OnHint = {read=FOnHint, write=FOnHint};
  10.  
  11. Description
  12.  
  13. 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.
  14.  
  15. 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.
  16.  
  17. 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.
  18.  
  19. Note: You can also respond to this event using the TApplicationEvents component, which allows you to assign an event handler using the IDE.
  20.  


Ответ отправил: 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

fedora (статус: Посетитель), 2 июля 2009, 15:08 [#2]:

спасибо. попробую

Чтобы оставлять сообщения в мини-форумах, Вы должны авторизироваться на сайте.

Версия движка: 2.6+ (26.01.2011)
Текущее время: 22 февраля 2025, 11:59
Выполнено за 0.03 сек.