Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi ComboBox Hint onItem? (https://www.delphipraxis.net/209549-combobox-hint-onitem.html)

Delphi.Narium 23. Dez 2021 14:15

AW: ComboBox Hint onItem?
 
Gibt's die bei Delphi 6 schon?
Delphi-Quellcode:
Application.HintPause     :=  250;
Application.HintHidePause := 10000;
Application.HintShortPause :=  250;
Application.HintShortCuts := True;
Delphi 7 hat's jedenfalls.

Werte nach Deinen Vorstellungen anpassen.

BerndS 23. Dez 2021 14:18

AW: ComboBox Hint onItem?
 
Ein Timer mit der gewünschten Verzögerung und im OnTimer dann FHintWindow.ActivateHint usw.

kagi3624 23. Dez 2021 15:58

AW: ComboBox Hint onItem?
 
Ich weiß zwar nicht was ich tue aber irgendwie scheint es so zu funktionieren

Code:
procedure TForm1.ApplicationIdle(sender: TObject; var Done: boolean);
var
  pt, pt2 : TPoint;
  wnd: HWND;
  buf: array[0..128] of Char;
  i : Integer;
begin

  GetCursorPos(pt);
  wnd := WindowFromPoint(pt);
  if wnd <> 0 then begin
    buf[0] := #0;
    GetClassName(wnd, buf, SizeOf(buf));
    if (StrIComp(buf, 'ComboLBox') = 0) then begin
      Windows.ScreenToClient(wnd, pt);
      i := SendMessage(wnd, LB_ITEMFROMPOINT, 0, lparam(PointToSmallpoint(pt)));
      if (i >= 0) and (i < 65536) then begin
        if (FHintIndex <> i) then begin
          SendMessage(wnd, LB_GETTEXT, i, integer(@buf));
          Sleep(500);
          GetCursorPos(pt2);
          Windows.ScreenToClient(wnd, pt2);
          StatusBar1.Panels[1].Text := inttostr(pt2.y);
          if (comboBox1.DroppedDown = true) and PointsEqual(pt,pt2) then begin
            GetCursorPos(pt);
            FHintWnd.ActivateHint(Rect(pt.X+10,pt.Y,pt.X+410,pt.Y+180), StandardHint[i]);
            FHintIndex := i;
          end;
        end;
      end;
    end;
  end;

end;
Die eine Punktkoordinate schreibe ich irgendwohin, damit es noch einmal updateted wird und lösche die dann später mit CloseUp.

HolgerX 24. Dez 2021 08:27

AW: ComboBox Hint onItem?
 
Hmm..

Euch ist schon bewusst, dass das hier verwendete FHintWnd NICHT das gleiche ist welches intern bei Application verwendet wird?

Sleep ist auch eine ungünstige Idee.. Denn hier wird die Applikation für die Zeit angehalten, somit komplett verzögert..

Ich hatte schon FHintIndex eingesetzt damit nicht beim gleichen Intex der Hint wieder neu gezeichnet wird und somit flackert.

Wenn Ihr Pausen und automatisches Schließen, sprich die Funktion von Application haben wollt, dann müsst Ihr das ganze Hint-System mit Timer und Co. nachbauen oder dort extrahieren.


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:00 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz