![]() |
Nonvcl Listbox LB_SETTOPINDEX
Wieder ListBox kommt noch einiges ;)
Habe eine Function angelegt für MouseWeel.
Delphi-Quellcode:
type
TSkinListBox = class private LStyle: DWORD; hFDefault: hFont; BColor, FColor: COLORREF; FHOwner: HWND; function DefaultFont: hFont; procedure SetCTLFont(hCtL: HWND; Font: hFont); procedure SubClass(WinHandle: HWND); procedure UnSubClass(WinHandle: HWND); public Handle: HWND; procedure DrawItem(lP: Integer); procedure ListSetTopIndex(hList: HWND; nTopIndex: Integer); function ListGetTopIndex(hList: HWND): Integer; constructor Create(hOwner: HWND; FullpathImageName: string; x, y, xW, yH, ListID: integer; Visible: Boolean; BackBitmap: string; AktForecolor: COLORREF; InAktForecolor: COLORREF; BackColor: COLORREF); destructor Destroy; override; end;
Delphi-Quellcode:
Wenn ich nun in der ListBoxProc(nicht in der Classe implementiert) TSkinListBox.ListGetTopIndex aufrufe dann meckert der compiler !
function TSkinListBox.ListGetTopIndex(hList: HWND): Integer;
var nGetTopIndex: Integer; begin nGetTopIndex := -1; if hList <> 0 then begin nGetTopIndex := SendMessage(hList, LB_GETTOPINDEX, 0, 0); if nGetTopIndex > -1 then inc(nGetTopIndex); end; Result := nGetTopIndex; end Zitat:
gruss Emil |
Re: Nonvcl Listbox LB_SETTOPINDEX
Musst Du die Proc dann nicht als class procedure deklarieren? ;)
|
Re: Nonvcl Listbox LB_SETTOPINDEX
Zitat:
gib mir einen TIP ;) Kann zwar halbwegs mit API aber einige dinge von Delphi sind mir noch nicht bekannt :) gruss EMil |
Re: Nonvcl Listbox LB_SETTOPINDEX
Delphi-Quellcode:
Du willst ja mit der Klasse die Funktion aufrufen und nicht mit einer Objekt-Referenz ... das muss man bei der Klassendefinition berücksichtigen.
type
TSkinListBox = class private LStyle: DWORD; hFDefault: hFont; BColor, FColor: COLORREF; FHOwner: HWND; function DefaultFont: hFont; procedure SetCTLFont(hCtL: HWND; Font: hFont); procedure SubClass(WinHandle: HWND); procedure UnSubClass(WinHandle: HWND); public Handle: HWND; procedure DrawItem(lP: Integer); procedure ListSetTopIndex(hList: HWND; nTopIndex: Integer); class function ListGetTopIndex(hList: HWND): Integer; // <-- DA IS :) constructor Create(hOwner: HWND; FullpathImageName: string; x, y, xW, yH, ListID: integer; Visible: Boolean; BackBitmap: string; AktForecolor: COLORREF; InAktForecolor: COLORREF; BackColor: COLORREF); destructor Destroy; override; end; |
Re: Nonvcl Listbox LB_SETTOPINDEX
Danke!
Ahh wieder was dazu gelernt. Funktioniert.
Delphi-Quellcode:
Ähnlich byRef in VB denk ich mal..
class function TSkinListBox.ListGetTopIndex(hList: HWND): Integer;
var nGetTopIndex: Integer; begin nGetTopIndex := -1; if hList <> 0 then begin nGetTopIndex := SendMessage(hList, LB_GETTOPINDEX, 0, 0); if nGetTopIndex > -1 then inc(nGetTopIndex); end; Result := nGetTopIndex; end; Muss man wissen ;) gruss Emil |
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:34 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz