mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 00:59:31 +02:00
convert lcl messages to new interface using methods: LM_{G,S}ETSELSTART, LM_{G,S}ETSELLEN, LM_{G,S}ETLIMITTEXT
git-svn-id: trunk@5930 -
This commit is contained in:
parent
135948348e
commit
12e184b13e
@ -33,7 +33,7 @@ begin
|
||||
inherited CreateWnd;
|
||||
|
||||
// get the interface based item list
|
||||
NewStrings:= TStrings(Pointer(CNSendMessage(LM_GETITEMS, Self, nil)));
|
||||
NewStrings:= TWSCustomComboBoxClass(WidgetSetClass).GetItems(Self);
|
||||
// then delete internal list
|
||||
if (FItems<>NewStrings) and (FItems<>nil) then begin
|
||||
NewStrings.Assign(FItems);
|
||||
@ -44,7 +44,7 @@ begin
|
||||
ParentColor := false;
|
||||
|
||||
if FItemIndex <> -1 then
|
||||
CNSendMessage(LM_SETITEMINDEX, Self, Pointer(FItemIndex));
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
|
||||
CNSendMessage(LM_SETPROPERTIES, Self, nil);
|
||||
end;
|
||||
|
||||
@ -141,7 +141,7 @@ begin
|
||||
if Val<>MaxLength then begin
|
||||
fMaxlength:=Val;
|
||||
if HandleAllocated then
|
||||
CNSendMessage(LM_SETLIMITTEXT, Self, @Val);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetMaxLength(Self, Val);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -155,7 +155,7 @@ end;
|
||||
function TCustomComboBox.GetMaxLength : integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
fMaxLength := CNSendMessage(LM_GETLIMITTEXT, Self, nil);
|
||||
fMaxLength := TWSCustomComboBoxClass(WidgetSetClass).GetMaxLength(Self);
|
||||
Result:=fMaxLength;
|
||||
end;
|
||||
|
||||
@ -280,7 +280,7 @@ end;
|
||||
function TCustomComboBox.GetSelStart : integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
fSelStart:=CNSendMessage(LM_GETSELSTART, Self, nil);
|
||||
fSelStart:=TWSCustomComboBoxClass(WidgetSetClass).GetSelStart(Self);
|
||||
Result:=fSelStart;
|
||||
end;
|
||||
|
||||
@ -295,7 +295,7 @@ procedure TCustomComboBox.SetSelStart(Val : integer);
|
||||
begin
|
||||
fSelStart:=Val;
|
||||
if HandleAllocated then
|
||||
CNSendMessage(LM_SETSELSTART, Self, Pointer(Val));
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetSelStart(Self, Val);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -308,7 +308,7 @@ end;
|
||||
function TCustomComboBox.GetSelLength : integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
fSelLength := CNSendMessage(LM_GETSELLEN, Self, nil);
|
||||
fSelLength := TWSCustomComboBoxClass(WidgetSetClass).GetSelLength(Self);
|
||||
Result:=fSelLength;
|
||||
end;
|
||||
|
||||
@ -323,7 +323,7 @@ procedure TCustomComboBox.SetSelLength(Val : integer);
|
||||
begin
|
||||
fSelLength:=Val;
|
||||
if HandleAllocated then
|
||||
CNSendMessage(LM_SETSELLEN, Self, Pointer(Val));
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetSelLength(Self, Val);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -688,7 +688,7 @@ end;
|
||||
function TCustomComboBox.GetItemIndex : integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
FItemIndex:= CNSendMessage(LM_GETITEMINDEX, Self, nil);
|
||||
FItemIndex:= TWSCustomComboBoxClass(WidgetSetClass).GetItemIndex(Self);
|
||||
Result:=FItemIndex;
|
||||
end;
|
||||
|
||||
@ -706,7 +706,7 @@ begin
|
||||
//if (FItemIndex>=0) and (not (csLoading in ComponentState)) then
|
||||
// Text:=FItems[FItemIndex];
|
||||
if HandleAllocated then
|
||||
CNSendMessage(LM_SETITEMINDEX, Self, Pointer(FItemIndex));
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -783,22 +783,18 @@ end;
|
||||
procedure TCustomComboBox.UpdateSorted;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCustomComboBox.UpdateSorted;
|
||||
var
|
||||
AMessage : TLMSort;
|
||||
begin
|
||||
if not HandleAllocated then exit;
|
||||
with AMessage do begin
|
||||
Msg:= LM_SORT;
|
||||
List:= Items;
|
||||
IsSorted:= FSorted;
|
||||
end;
|
||||
CNSendMessage(LM_SORT, Self, @AMessage);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).Sort(Self, Items, FSorted);
|
||||
end;
|
||||
|
||||
// included by stdctrls.pp
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.45 2004/09/07 09:44:46 micha
|
||||
convert lcl messages to new interface using methods: LM_{G,S}ETSELSTART, LM_{G,S}ETSELLEN, LM_{G,S}ETLIMITTEXT
|
||||
|
||||
Revision 1.44 2004/09/01 10:25:58 mattias
|
||||
added some project flags to start getting rid of TProjectType
|
||||
|
||||
|
@ -108,7 +108,7 @@ end;
|
||||
function TCustomEdit.GetSelStart : integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
FSelStart:= CNSendMessage(LM_GETSELSTART, Self, nil);
|
||||
FSelStart:= TWSCustomEditClass(WidgetSetClass).GetSelStart(Self);
|
||||
Result:= FSelStart;
|
||||
end;
|
||||
|
||||
@ -123,7 +123,7 @@ procedure TCustomEdit.SetSelStart(Val : integer);
|
||||
begin
|
||||
FSelStart:= Val;
|
||||
if HandleAllocated then
|
||||
CNSendMessage(LM_SETSELSTART, Self, Pointer(Val));
|
||||
TWSCustomEditClass(WidgetSetClass).SetSelStart(Self, Val);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -136,7 +136,7 @@ end;
|
||||
function TCustomEdit.GetSelLength : integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
FSelLength := CNSendMessage(LM_GETSELLEN, Self, nil);
|
||||
FSelLength := TWSCustomEditClass(WidgetSetClass).GetSelLength(Self);
|
||||
Result:= FSelLength;
|
||||
end;
|
||||
|
||||
@ -151,7 +151,7 @@ procedure TCustomEdit.SetSelLength(Val : integer);
|
||||
begin
|
||||
FSelLength:= Val;
|
||||
if HandleAllocated then
|
||||
CNSendMessage(LM_SETSELLEN, Self, Pointer(Val));
|
||||
TWSCustomEditClass(WidgetSetClass).SetSelLength(Self, Val);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -380,6 +380,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.32 2004/09/07 09:44:46 micha
|
||||
convert lcl messages to new interface using methods: LM_{G,S}ETSELSTART, LM_{G,S}ETSELLEN, LM_{G,S}ETLIMITTEXT
|
||||
|
||||
Revision 1.31 2004/08/25 20:16:12 marc
|
||||
* fixed infinite for maxlength
|
||||
|
||||
|
@ -64,14 +64,14 @@ end;
|
||||
function TCustomSpinEdit.GetSelLength: integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
FSelLength := CNSendMessage(LM_GETSELLEN, Self, nil);
|
||||
FSelLength := TWSCustomSpinEditClass(WidgetSetClass).GetSelLength(Self);
|
||||
Result:= FSelLength;
|
||||
end;
|
||||
|
||||
function TCustomSpinEdit.GetSelStart: integer;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
FSelStart:= CNSendMessage(LM_GETSELSTART, Self, nil);
|
||||
FSelStart:= TWSCustomSpinEditClass(WidgetSetClass).GetSelStart(Self);
|
||||
Result:= FSelStart;
|
||||
end;
|
||||
|
||||
@ -109,14 +109,14 @@ procedure TCustomSpinEdit.SetSelLength(const AValue: integer);
|
||||
begin
|
||||
FSelLength:= AValue;
|
||||
if HandleAllocated then
|
||||
CNSendMessage(LM_SETSELLEN, Self, Pointer(FSelLength));
|
||||
TWSCustomSpinEditClass(WidgetSetClass).SetSelLength(Self, FSelLength);
|
||||
end;
|
||||
|
||||
procedure TCustomSpinEdit.SetSelStart(const AValue: integer);
|
||||
begin
|
||||
FSelStart:= AValue;
|
||||
if HandleAllocated then
|
||||
CNSendMessage(LM_SETSELSTART, Self, Pointer(FSelStart));
|
||||
TWSCustomSpinEditClass(WidgetSetClass).SetSelStart(Self, FSelStart);
|
||||
end;
|
||||
|
||||
procedure TCustomSpinEdit.SetSelText(const AValue: String);
|
||||
@ -175,12 +175,9 @@ end;
|
||||
|
||||
{-----------------------------------------------------------------------------}
|
||||
Function TCustomSpinEdit.GetValue: Single;
|
||||
Var
|
||||
Temp : Single;
|
||||
begin
|
||||
if HandleAllocated and (not fValueNeedsUpdate) then begin
|
||||
CNSendMessage(LM_GETVALUE,Self,@Temp);
|
||||
FValue := Temp;
|
||||
FValue := TWSCustomSpinEditClass(WidgetSetClass).GetValue(Self);
|
||||
end;
|
||||
GetValue := fValue;
|
||||
end;
|
||||
|
@ -359,8 +359,8 @@ uses
|
||||
// GtkWSMaskEdit,
|
||||
// GtkWSMenus,
|
||||
// GtkWSPairSplitter,
|
||||
// GtkWSSpin,
|
||||
// GtkWSStdCtrls,
|
||||
GtkWSSpin,
|
||||
GtkWSStdCtrls,
|
||||
// GtkWSToolwin,
|
||||
////////////////////////////////////////////////////
|
||||
Buttons, StdCtrls, PairSplitter, Math,
|
||||
@ -462,6 +462,9 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.189 2004/09/07 09:44:46 micha
|
||||
convert lcl messages to new interface using methods: LM_{G,S}ETSELSTART, LM_{G,S}ETSELLEN, LM_{G,S}ETLIMITTEXT
|
||||
|
||||
Revision 1.188 2004/09/02 09:16:59 mattias
|
||||
improved double byte char fonts for gtk1, started synedit UTF8 support
|
||||
|
||||
|
@ -3505,9 +3505,6 @@ begin
|
||||
{$Else}
|
||||
begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csComboBox:
|
||||
Result:=longint(gtk_object_get_data(PGtkObject(Handle),'LCLList'));
|
||||
|
||||
csCListBox:
|
||||
begin
|
||||
Widget:= GetWidgetInfo(Pointer(Handle), True)^.CoreWidget;
|
||||
@ -3541,9 +3538,6 @@ begin
|
||||
LM_GETITEMINDEX :
|
||||
begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csComboBox:
|
||||
Result:=GetComboBoxItemIndex(TComboBox(Sender));
|
||||
|
||||
{$IFdef GTK1}
|
||||
csListBox, csCheckListBox:
|
||||
begin
|
||||
@ -3595,9 +3589,6 @@ begin
|
||||
if Handle<>0 then begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
|
||||
csComboBox:
|
||||
SetComboBoxItemIndex(TComboBox(Sender),Integer(Data));
|
||||
|
||||
{$IFdef GTK1}
|
||||
csListBox, csCheckListBox:
|
||||
begin
|
||||
@ -3629,106 +3620,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
LM_GETSELSTART :
|
||||
begin
|
||||
if (Sender is TControl) then begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csComboBox:
|
||||
Widget:= PGtkWidget(PGtkCombo(Handle)^.entry);
|
||||
{$IfDef GTK1}
|
||||
csEdit, csMemo:
|
||||
Widget:= GetWidgetInfo(Pointer(Handle), true)^.CoreWidget;
|
||||
{$EndIf}
|
||||
else
|
||||
Widget:= nil;
|
||||
end;
|
||||
if Widget <> nil then begin
|
||||
if PGtkOldEditable(Widget)^.selection_start_pos
|
||||
< PGtkOldEditable(Widget)^.selection_end_pos
|
||||
then
|
||||
Result:= PGtkOldEditable(Widget)^.selection_start_pos
|
||||
else
|
||||
Result:= PGtkOldEditable(Widget)^.current_pos;// selection_end_pos
|
||||
end else Result:= 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
LM_GETSELLEN :
|
||||
begin
|
||||
if (Sender is TControl) then begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csComboBox:
|
||||
with PGtkOldEditable(PGtkCombo(Handle)^.entry)^ do begin
|
||||
Result:= Abs(integer(selection_end_pos)-integer(selection_start_pos));
|
||||
end;
|
||||
{$IfDef GTK1}
|
||||
csEdit, csMemo:
|
||||
begin
|
||||
Widget:= GetWidgetInfo(Pointer(Handle), true)^.CoreWidget;
|
||||
with PGtkOldEditable(Widget)^ do begin
|
||||
Result:=Abs(integer(selection_end_pos)-integer(selection_start_pos));
|
||||
end;
|
||||
end;
|
||||
{$EndIf}
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
LM_GETLIMITTEXT :
|
||||
begin
|
||||
if (Sender is TControl)
|
||||
and (TControl(Sender).fCompStyle = csComboBox) then
|
||||
begin
|
||||
Result:= PGtkEntry(PGtkCombo(Handle)^.entry)^.text_max_length;
|
||||
end;
|
||||
end;
|
||||
|
||||
LM_SETSELSTART:
|
||||
begin
|
||||
if (Sender is TControl) then begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csComboBox:
|
||||
Widget:=PGtkCombo(Handle)^.entry;
|
||||
|
||||
{$IfDef GTK1}
|
||||
csEdit, csMemo:
|
||||
Widget:=GetWidgetInfo(Pointer(Handle), true)^.CoreWidget;
|
||||
{$EndIf}
|
||||
|
||||
else
|
||||
Widget:=nil;
|
||||
end;
|
||||
|
||||
if Widget<>nil then begin
|
||||
gtk_editable_set_position(PGtkOldEditable(Widget), Integer(Data));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
LM_SETSELLEN :
|
||||
begin
|
||||
if (Sender is TControl) then begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csComboBox:
|
||||
Widget:=PGtkCombo(Handle)^.entry;
|
||||
|
||||
{$IfDef GTK1}
|
||||
csEdit, csMemo:
|
||||
Widget:=GetWidgetInfo(Pointer(Handle), true)^.CoreWidget;
|
||||
{$EndIf}
|
||||
|
||||
else
|
||||
Widget:=nil;
|
||||
end;
|
||||
|
||||
if Widget<>nil then begin
|
||||
gtk_editable_select_region(PGtkOldEditable(Widget),
|
||||
gtk_editable_get_position(PGtkOldEditable(Widget)),
|
||||
gtk_editable_get_position(PGtkOldEditable(Widget)) + Integer(Data));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
LM_GetLineCount :
|
||||
begin
|
||||
DebugLn('ToDo: LM_GetLineCount');
|
||||
@ -3840,21 +3731,12 @@ begin
|
||||
end;
|
||||
{$EndIf}
|
||||
|
||||
LM_SETLIMITTEXT :
|
||||
begin
|
||||
if (Sender is TControl) and (TControl(Sender).fCompStyle = csComboBox)
|
||||
then gtk_entry_set_max_length(PGtkEntry(PGtkCombo(Handle)^.entry),
|
||||
Integer(Data^));
|
||||
end;
|
||||
|
||||
LM_SORT:
|
||||
begin
|
||||
if (Sender is TControl) and assigned (data) then
|
||||
begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csComboBox
|
||||
{$Ifdef GTK1}
|
||||
,
|
||||
csListBox,
|
||||
csCheckListBox
|
||||
{$EndIf} : TGtkListStringList(TLMSort(Data^).List).Sorted:=
|
||||
@ -9273,6 +9155,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.539 2004/09/07 09:44:46 micha
|
||||
convert lcl messages to new interface using methods: LM_{G,S}ETSELSTART, LM_{G,S}ETSELLEN, LM_{G,S}ETLIMITTEXT
|
||||
|
||||
Revision 1.538 2004/09/06 22:24:52 mattias
|
||||
started the carbon LCL interface
|
||||
|
||||
|
@ -33,9 +33,14 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// StdCtrls,
|
||||
StdCtrls,
|
||||
////////////////////////////////////////////////////
|
||||
WSStdCtrls, WSLCLClasses, GtkInt;
|
||||
{$IFDEF gtk2}
|
||||
glib2, gdk2pixbuf, gdk2, gtk2, Pango,
|
||||
{$ELSE}
|
||||
glib, gdk, gtk, {$Ifndef NoGdkPixbufLib}gdkpixbuf,{$EndIf} GtkFontCache,
|
||||
{$ENDIF}
|
||||
WSStdCtrls, WSLCLClasses, GtkInt, Classes;
|
||||
|
||||
type
|
||||
|
||||
@ -69,6 +74,18 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function GetSelStart(const ACustomComboBox: TCustomComboBox): integer; override;
|
||||
class function GetSelLength(const ACustomComboBox: TCustomComboBox): integer; override;
|
||||
class function GetItemIndex(const ACustomComboBox: TCustomComboBox): integer; override;
|
||||
class function GetMaxLength(const ACustomComboBox: TCustomComboBox): integer; override;
|
||||
|
||||
class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
|
||||
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); override;
|
||||
class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
|
||||
|
||||
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override;
|
||||
class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); override;
|
||||
end;
|
||||
|
||||
{ TGtkWSComboBox }
|
||||
@ -101,6 +118,11 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override;
|
||||
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;
|
||||
|
||||
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
||||
end;
|
||||
|
||||
{ TGtkWSCustomMemo }
|
||||
@ -167,14 +189,6 @@ type
|
||||
public
|
||||
end;
|
||||
|
||||
{ TGtkWSCheckBox }
|
||||
|
||||
TGtkWSCheckBox = class(TWSCheckBox)
|
||||
private
|
||||
protected
|
||||
public
|
||||
end;
|
||||
|
||||
{ TGtkWSToggleBox }
|
||||
|
||||
TGtkWSToggleBox = class(TWSToggleBox)
|
||||
@ -210,6 +224,128 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Buttons, PairSplitter, Math,
|
||||
GTKWinApiWindow, ComCtrls, CListBox, Calendar, Arrow, Spin, CommCtrl,
|
||||
ExtCtrls, FileCtrl, LResources, gtkglobals, gtkproc;
|
||||
|
||||
|
||||
{ helper routines }
|
||||
|
||||
function WidgetGetSelStart(const Widget: PGtkWidget): integer;
|
||||
begin
|
||||
if Widget <> nil then
|
||||
begin
|
||||
if PGtkOldEditable(Widget)^.selection_start_pos
|
||||
< PGtkOldEditable(Widget)^.selection_end_pos
|
||||
then
|
||||
Result:= PGtkOldEditable(Widget)^.selection_start_pos
|
||||
else
|
||||
Result:= PGtkOldEditable(Widget)^.current_pos;// selection_end_pos
|
||||
end else
|
||||
Result:= 0;
|
||||
end;
|
||||
|
||||
procedure WidgetSetSelLength(const Widget: PGtkWidget; NewLength: integer);
|
||||
begin
|
||||
if Widget<>nil then
|
||||
begin
|
||||
gtk_editable_select_region(PGtkOldEditable(Widget),
|
||||
gtk_editable_get_position(PGtkOldEditable(Widget)),
|
||||
gtk_editable_get_position(PGtkOldEditable(Widget)) + NewLength);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ TGtkWSCustomComboBox }
|
||||
|
||||
function TGtkWSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
Result := WidgetGetSelStart(PGtkWidget(PGtkCombo(ACustomComboBox.Handle)^.entry));
|
||||
end;
|
||||
|
||||
function TGtkWSCustomComboBox.GetSelLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
with PGtkOldEditable(PGtkCombo(ACustomComboBox.Handle)^.entry)^ do begin
|
||||
Result:= Abs(integer(selection_end_pos)-integer(selection_start_pos));
|
||||
end;
|
||||
end;
|
||||
|
||||
function TGtkWSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
// TODO: ugly typecast to tcombobox
|
||||
Result:=GetComboBoxItemIndex(TComboBox(ACustomComboBox));
|
||||
end;
|
||||
|
||||
function TGtkWSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
Result:= PGtkEntry(PGtkCombo(ACustomComboBox.Handle)^.entry)^.text_max_length;
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomComboBox.SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer);
|
||||
begin
|
||||
gtk_editable_set_position(PGtkOldEditable(PGtkCombo(ACustomComboBox.Handle)^.entry), NewStart);
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomComboBox.SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer);
|
||||
begin
|
||||
WidgetSetSelLength(PGtkCombo(ACustomComboBox.Handle)^.entry, NewLength);
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomComboBox.SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer);
|
||||
begin
|
||||
// TODO: ugly typecast
|
||||
SetComboBoxItemIndex(TComboBox(ACustomComboBox), NewIndex);
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer);
|
||||
begin
|
||||
gtk_entry_set_max_length(PGtkEntry(PGtkCombo(ACustomComboBox.Handle)^.entry), NewLength);
|
||||
end;
|
||||
|
||||
function TGtkWSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox): TStrings;
|
||||
begin
|
||||
Result := TStrings(gtk_object_get_data(PGtkObject(ACustomComboBox.Handle), 'LCLList'));
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean);
|
||||
begin
|
||||
TGtkListStringList(AList).Sorted := IsSorted;
|
||||
end;
|
||||
|
||||
{ TGtkWSCustomEdit }
|
||||
|
||||
function TGtkWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
|
||||
begin
|
||||
{$IfDef GTK1}
|
||||
Result := WidgetGetSelStart(GetWidgetInfo(Pointer(ACustomEdit.Handle), true)^.CoreWidget);
|
||||
{$EndIf}
|
||||
end;
|
||||
|
||||
function TGtkWSCustomEdit.GetSelLength(const ACustomEdit: TCustomEdit): integer;
|
||||
begin
|
||||
{$IfDef GTK1}
|
||||
with PGtkOldEditable(GetWidgetInfo(Pointer(ACustomEdit.Handle), true)^.CoreWidget)^ do begin
|
||||
Result:=Abs(integer(selection_end_pos)-integer(selection_start_pos));
|
||||
end;
|
||||
{$EndIf}
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomEdit.SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer);
|
||||
begin
|
||||
{$IfDef GTK1}
|
||||
gtk_editable_set_position(PGtkOldEditable(GetWidgetInfo(
|
||||
Pointer(ACustomEdit.Handle), true)^.CoreWidget), NewStart);
|
||||
{$EndIf}
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomEdit.SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer);
|
||||
begin
|
||||
{$IfDef GTK1}
|
||||
WidgetSetSelLength(GetWidgetInfo(Pointer(ACustomEdit.Handle), true)^.CoreWidget, NewLength);
|
||||
{$EndIf}
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@ -221,11 +357,11 @@ initialization
|
||||
// RegisterWSComponent(TScrollBar, TGtkWSScrollBar);
|
||||
// RegisterWSComponent(TCustomGroupBox, TGtkWSCustomGroupBox);
|
||||
// RegisterWSComponent(TGroupBox, TGtkWSGroupBox);
|
||||
// RegisterWSComponent(TCustomComboBox, TGtkWSCustomComboBox);
|
||||
RegisterWSComponent(TCustomComboBox, TGtkWSCustomComboBox);
|
||||
// RegisterWSComponent(TComboBox, TGtkWSComboBox);
|
||||
// RegisterWSComponent(TCustomListBox, TGtkWSCustomListBox);
|
||||
// RegisterWSComponent(TListBox, TGtkWSListBox);
|
||||
// RegisterWSComponent(TCustomEdit, TGtkWSCustomEdit);
|
||||
RegisterWSComponent(TCustomEdit, TGtkWSCustomEdit);
|
||||
// RegisterWSComponent(TCustomMemo, TGtkWSCustomMemo);
|
||||
// RegisterWSComponent(TEdit, TGtkWSEdit);
|
||||
// RegisterWSComponent(TMemo, TGtkWSMemo);
|
||||
|
@ -238,7 +238,7 @@ Uses
|
||||
// Win32WSMaskEdit,
|
||||
// Win32WSMenus,
|
||||
// Win32WSPairSplitter,
|
||||
// Win32WSSpin,
|
||||
Win32WSSpin,
|
||||
Win32WSStdCtrls,
|
||||
// Win32WSToolwin,
|
||||
////////////////////////////////////////////////////
|
||||
@ -285,6 +285,9 @@ End.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.95 2004/09/07 09:44:46 micha
|
||||
convert lcl messages to new interface using methods: LM_{G,S}ETSELSTART, LM_{G,S}ETSELLEN, LM_{G,S}ETLIMITTEXT
|
||||
|
||||
Revision 1.94 2004/08/27 08:55:23 micha
|
||||
implement tapplication.minimize for win32, stub for gtk
|
||||
|
||||
|
@ -423,7 +423,7 @@ Var
|
||||
//CBI: COMBOBOXINFO;
|
||||
DC: HDC;
|
||||
Handle: HWND;
|
||||
I, Num: Integer;
|
||||
Num: Integer;
|
||||
PStr, PStr2: PChar;
|
||||
SizeRect: TRECT; // used by LM_SETSIZE,LM_INVALIDATE,LM_CLB_SET_CHECKED and LM_REDRAW
|
||||
S: String;
|
||||
@ -801,15 +801,6 @@ activate_time : the time at which the activation event occurred.
|
||||
LM_GETITEMINDEX :
|
||||
Begin
|
||||
Case (Sender as TControl).FCompStyle Of
|
||||
csComboBox:
|
||||
Begin
|
||||
Result := SendMessage(Handle, CB_GETCURSEL, 0, 0);
|
||||
if Result = LB_ERR Then
|
||||
Begin
|
||||
Assert(False, 'Trace:[TWin32WidgetSet.IntSendMessage3] Could not retrieve item index via LM_GETITEMINDEX; try selecting an item first');
|
||||
Result := -1;
|
||||
End;
|
||||
End;
|
||||
csListBox, csCListBox:
|
||||
Begin
|
||||
Result := SendMessage(Handle, LB_GETCURSEL, 0, 0);
|
||||
@ -828,7 +819,6 @@ activate_time : the time at which the activation event occurred.
|
||||
LM_SETITEMINDEX :
|
||||
Begin
|
||||
Case (Sender as TControl).FCompStyle Of
|
||||
csComboBox: Windows.SendMessage(Handle, CB_SETCURSEL, Windows.WParam(Integer(Data)), 0);
|
||||
csListBox, csCListBox:
|
||||
Begin
|
||||
If TListBox(Sender).MultiSelect Then
|
||||
@ -843,73 +833,6 @@ activate_time : the time at which the activation event occurred.
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
LM_GETSELSTART:
|
||||
begin
|
||||
case (Sender as TControl).FCompStyle of
|
||||
csComboBox:
|
||||
begin
|
||||
Result := Low(Windows.SendMessage(Handle, CB_GETEDITSEL, Windows.WPARAM(nil), Windows.LPARAM(nil)));
|
||||
end;
|
||||
csEdit:
|
||||
begin
|
||||
Windows.SendMessage(Handle, EM_GETSEL, Windows.WPARAM(@i), 0);
|
||||
Result := i;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
LM_GETSELLEN:
|
||||
begin
|
||||
case (Sender as TControl).FCompStyle of
|
||||
csComboBox:
|
||||
begin
|
||||
Result := Windows.SendMessage(Handle, CB_GETEDITSEL, Windows.WPARAM(nil), Windows.LPARAM(nil));
|
||||
end;
|
||||
csEdit:
|
||||
begin
|
||||
Windows.SendMessage(Handle, EM_GETSEL, Windows.WPARAM(@i), Windows.LPARAM(@num));
|
||||
Result := num-i;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
LM_GETLIMITTEXT:
|
||||
Begin
|
||||
If (Sender as TControl).FCompStyle = csComboBox Then
|
||||
Begin
|
||||
Result := Integer(GetProp(Handle, 'LIMIT_TEXT'));
|
||||
End;
|
||||
End;
|
||||
LM_SETSELSTART:
|
||||
Begin
|
||||
if Sender is TControl then
|
||||
case TControl(Sender).FCompStyle of
|
||||
csComboBox:
|
||||
begin
|
||||
SendMessage(Handle, CB_SETEDITSEL, 0, MakeLParam(integer(Data), integer(Data)));
|
||||
end;
|
||||
csEdit:
|
||||
begin
|
||||
SendMessage(Handle, EM_SETSEL, Windows.WParam(Data), Windows.LParam(Data));
|
||||
end;
|
||||
end;
|
||||
End;
|
||||
LM_SETSELLEN:
|
||||
Begin
|
||||
if Sender is TControl then
|
||||
Case TControl(Sender).FCompStyle of
|
||||
csComboBox:
|
||||
begin
|
||||
Windows.SendMessage(Handle, CB_GETEDITSEL, Windows.Wparam(@i), Windows.LParam(@Num));
|
||||
Num := i + Integer(Data);
|
||||
Windows.SendMessage(Handle, CB_SETEDITSEL, 0, MakeLParam( i, Num ));
|
||||
end;
|
||||
csEdit:
|
||||
begin
|
||||
Windows.SendMessage(Handle, EM_GETSEL, Windows.Wparam(@i), Windows.LParam(@Num));
|
||||
Num := i + Integer(Data);
|
||||
Windows.SendMessage(Handle, EM_SETSEL, Windows.WParam(i), Windows.LParam(Num));
|
||||
end;
|
||||
end;
|
||||
End;
|
||||
LM_GETLINECOUNT:
|
||||
Begin
|
||||
If Sender Is TCustomMemo Then
|
||||
@ -944,7 +867,7 @@ activate_time : the time at which the activation event occurred.
|
||||
If (Sender Is TControl) And Assigned(Data) Then
|
||||
Begin
|
||||
Case TControl(Sender).FCompStyle Of
|
||||
csComboBox, csListBox:
|
||||
csListBox:
|
||||
TWin32ListStringList(TLMSort(Data^).List).Sorted :=
|
||||
TLMSort(Data^).IsSorted;
|
||||
csCListBox:
|
||||
@ -1338,8 +1261,6 @@ Begin
|
||||
Str := Lowercase(PChar(@Cls[0]));
|
||||
If Str = 'edit' Then
|
||||
Msg := CB_LIMITTEXT
|
||||
Else If Str = 'combo' Then
|
||||
Msg := EM_LIMITTEXT
|
||||
Else
|
||||
Exit;
|
||||
|
||||
@ -2666,10 +2587,6 @@ Begin
|
||||
With ST Do
|
||||
TLMCalendar(Data^).Date := EncodeDate(WYear,WMonth,WDay);
|
||||
End;
|
||||
csSpinEdit:
|
||||
Begin
|
||||
Single(Data^) := SendMessage(Handle, UDM_GETPOS, 0, 0);
|
||||
End;
|
||||
Else
|
||||
Assert (True, Format('WARNING:[TWin32WidgetSet.GetValue]] failed for %S', [Sender.ClassName]));
|
||||
End;
|
||||
@ -3092,6 +3009,9 @@ End;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.231 2004/09/07 09:44:46 micha
|
||||
convert lcl messages to new interface using methods: LM_{G,S}ETSELSTART, LM_{G,S}ETSELLEN, LM_{G,S}ETLIMITTEXT
|
||||
|
||||
Revision 1.230 2004/09/06 15:08:32 micha
|
||||
implement LM_GETSELLEN en LM_GETSELSTART for win32 edit controls
|
||||
|
||||
|
@ -33,9 +33,9 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// Spin,
|
||||
Spin,
|
||||
////////////////////////////////////////////////////
|
||||
WSSpin, WSLCLClasses;
|
||||
WSSpin, WSLCLClasses, Win32WSStdCtrls, Windows;
|
||||
|
||||
type
|
||||
|
||||
@ -45,6 +45,12 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function GetSelStart(const ACustomSpinEdit: TCustomSpinEdit): integer; override;
|
||||
class function GetSelLength(const ACustomSpinEdit: TCustomSpinEdit): integer; override;
|
||||
class function GetValue(const ACustomSpinEdit: TCustomSpinEdit): single; override;
|
||||
|
||||
class procedure SetSelStart(const ACustomSpinEdit: TCustomSpinEdit; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomSpinEdit: TCustomSpinEdit; NewLength: integer); override;
|
||||
end;
|
||||
|
||||
{ TWin32WSSpinEdit }
|
||||
@ -58,6 +64,33 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
{ TWin32WSCustomSpinEdit }
|
||||
|
||||
function TWin32WSCustomSpinEdit.GetSelStart(const ACustomSpinEdit: TCustomSpinEdit): integer;
|
||||
begin
|
||||
Result := EditGetSelStart(SendMessage(ACustomSpinEdit.Handle, UDM_GETBUDDY, 0, 0));
|
||||
end;
|
||||
|
||||
function TWin32WSCustomSpinEdit.GetSelLength(const ACustomSpinEdit: TCustomSpinEdit): integer;
|
||||
begin
|
||||
Result := EditGetSelLength(SendMessage(ACustomSpinEdit.Handle, UDM_GETBUDDY, 0, 0));
|
||||
end;
|
||||
|
||||
function TWin32WSCustomSpinEdit.GetValue(const ACustomSpinEdit: TCustomSpinEdit): single;
|
||||
begin
|
||||
Result := SendMessage(ACustomSpinEdit.Handle, UDM_GETPOS, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomSpinEdit.SetSelStart(const ACustomSpinEdit: TCustomSpinEdit; NewStart: integer);
|
||||
begin
|
||||
EditSetSelStart(SendMessage(ACustomSpinEdit.Handle, UDM_GETBUDDY, 0, 0), NewStart);
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomSpinEdit.SetSelLength(const ACustomSpinEdit: TCustomSpinEdit; NewLength: integer);
|
||||
begin
|
||||
EditSetSelLength(SendMessage(ACustomSpinEdit.Handle, UDM_GETBUDDY, 0, 0), NewLength);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@ -66,7 +99,7 @@ initialization
|
||||
// To improve speed, register only classes
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TCustomSpinEdit, TWin32WSCustomSpinEdit);
|
||||
RegisterWSComponent(TCustomSpinEdit, TWin32WSCustomSpinEdit);
|
||||
// RegisterWSComponent(TSpinEdit, TWin32WSSpinEdit);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
|
@ -35,7 +35,7 @@ uses
|
||||
////////////////////////////////////////////////////
|
||||
StdCtrls,
|
||||
////////////////////////////////////////////////////
|
||||
WSStdCtrls, WSLCLClasses;
|
||||
WSStdCtrls, WSLCLClasses, Classes, Windows;
|
||||
|
||||
type
|
||||
|
||||
@ -69,6 +69,18 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function GetSelStart(const ACustomComboBox: TCustomComboBox): integer; override;
|
||||
class function GetSelLength(const ACustomComboBox: TCustomComboBox): integer; override;
|
||||
class function GetItemIndex(const ACustomComboBox: TCustomComboBox): integer; override;
|
||||
class function GetMaxLength(const ACustomComboBox: TCustomComboBox): integer; override;
|
||||
|
||||
class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
|
||||
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); override;
|
||||
class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
|
||||
|
||||
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override;
|
||||
class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); override;
|
||||
end;
|
||||
|
||||
{ TWin32WSComboBox }
|
||||
@ -102,6 +114,11 @@ type
|
||||
private
|
||||
protected
|
||||
public
|
||||
class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override;
|
||||
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override;
|
||||
|
||||
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
|
||||
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
||||
end;
|
||||
|
||||
{ TWin32WSCustomMemo }
|
||||
@ -200,6 +217,12 @@ type
|
||||
public
|
||||
end;
|
||||
|
||||
{ useful helper functions }
|
||||
|
||||
function EditGetSelStart(WinHandle: HWND): integer;
|
||||
function EditGetSelLength(WinHandle: HWND): integer;
|
||||
procedure EditSetSelStart(WinHandle: HWND; NewStart: integer);
|
||||
procedure EditSetSelLength(WinHandle: HWND; NewLength: integer);
|
||||
|
||||
implementation
|
||||
|
||||
@ -214,6 +237,129 @@ begin
|
||||
TWin32WidgetSet(InterfaceObject).RecreateWnd(ACustomListBox);
|
||||
end;
|
||||
|
||||
{ TWin32WSCustomComboBox }
|
||||
|
||||
function TWin32WSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
Result := Low(SendMessage(ACustomComboBox.Handle, CB_GETEDITSEL, Windows.WPARAM(nil), Windows.LPARAM(nil)));
|
||||
end;
|
||||
|
||||
function TWin32WSCustomComboBox.GetSelLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
Result := SendMessage(ACustomComboBox.Handle, CB_GETEDITSEL, Windows.WPARAM(nil), Windows.LPARAM(nil));
|
||||
end;
|
||||
|
||||
function TWin32WSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
Result := SendMessage(ACustomComboBox.Handle, CB_GETCURSEL, 0, 0);
|
||||
if Result = LB_ERR Then
|
||||
Begin
|
||||
Assert(False, 'Trace:[TWin32WidgetSet.IntSendMessage3] Could not retrieve item index '+
|
||||
'via LM_GETITEMINDEX; try selecting an item first');
|
||||
Result := -1;
|
||||
End;
|
||||
end;
|
||||
|
||||
function TWin32WSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
Result := integer(GetProp(ACustomComboBox.Handle, 'MAXLENGTH'));
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomComboBox.SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer);
|
||||
begin
|
||||
SendMessage(ACustomComboBox.Handle, CB_SETEDITSEL, 0, MakeLParam(NewStart, NewStart));
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomComboBox.SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer);
|
||||
var
|
||||
startpos, endpos: integer;
|
||||
winhandle: HWND;
|
||||
begin
|
||||
winhandle := ACustomComboBox.Handle;
|
||||
SendMessage(winhandle, CB_GETEDITSEL, Windows.WParam(@startpos), Windows.LParam(@endpos));
|
||||
endpos := startpos + NewLength;
|
||||
SendMessage(winhandle, CB_SETEDITSEL, 0, MakeLParam(startpos, endpos));
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomComboBox.SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer);
|
||||
begin
|
||||
SendMessage(ACustomComboBox.Handle, CB_SETCURSEL, Windows.WParam(NewIndex), 0);
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer);
|
||||
var
|
||||
winhandle: HWND;
|
||||
begin
|
||||
winhandle := ACustomComboBox.Handle;
|
||||
SendMessage(winhandle, CB_LIMITTEXT, NewLength, 0);
|
||||
SetProp(winhandle, 'MAXLENGTH', NewLength);
|
||||
end;
|
||||
|
||||
function TWin32WSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox): TStrings;
|
||||
var
|
||||
winhandle: HWND;
|
||||
begin
|
||||
winhandle := ACustomComboBox.Handle;
|
||||
Result := TWin32ListStringList.Create(winhandle, ACustomComboBox);
|
||||
SetProp(winhandle, 'List', dword(Result));
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean);
|
||||
begin
|
||||
TWin32ListStringList(AList).Sorted := IsSorted;
|
||||
end;
|
||||
|
||||
{ TWin32WSCustomEdit helper functions }
|
||||
|
||||
function EditGetSelStart(WinHandle: HWND): integer;
|
||||
begin
|
||||
SendMessage(WinHandle, EM_GETSEL, Windows.WPARAM(@Result), 0);
|
||||
end;
|
||||
|
||||
function EditGetSelLength(WinHandle: HWND): integer;
|
||||
var
|
||||
startpos, endpos: integer;
|
||||
begin
|
||||
SendMessage(WinHandle, EM_GETSEL, Windows.WPARAM(@startpos), Windows.LPARAM(@endpos));
|
||||
Result := endpos - startpos;
|
||||
end;
|
||||
|
||||
procedure EditSetSelStart(WinHandle: HWND; NewStart: integer);
|
||||
begin
|
||||
SendMessage(WinHandle, EM_SETSEL, Windows.WParam(NewStart), Windows.LParam(NewStart));
|
||||
end;
|
||||
|
||||
procedure EditSetSelLength(WinHandle: HWND; NewLength: integer);
|
||||
var
|
||||
startpos, endpos: integer;
|
||||
begin
|
||||
Windows.SendMessage(WinHandle, EM_GETSEL, Windows.WParam(@startpos), Windows.LParam(@endpos));
|
||||
endpos := startpos + NewLength;
|
||||
Windows.SendMessage(WinHandle, EM_SETSEL, Windows.WParam(startpos), Windows.LParam(endpos));
|
||||
end;
|
||||
|
||||
{ TWin32WSCustomEdit }
|
||||
|
||||
function TWin32WSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
|
||||
begin
|
||||
Result := EditGetSelStart(ACustomEdit.Handle);
|
||||
end;
|
||||
|
||||
function TWin32WSCustomEdit.GetSelLength(const ACustomEdit: TCustomEdit): integer;
|
||||
begin
|
||||
Result := EditGetSelLength(ACustomEdit.Handle);
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomEdit.SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer);
|
||||
begin
|
||||
EditSetSelStart(ACustomEdit.Handle, NewStart);
|
||||
end;
|
||||
|
||||
procedure TWin32WSCustomEdit.SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer);
|
||||
begin
|
||||
EditSetSelLength(ACustomEdit.Handle, NewLength);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@ -225,11 +371,11 @@ initialization
|
||||
// RegisterWSComponent(TScrollBar, TWin32WSScrollBar);
|
||||
// RegisterWSComponent(TCustomGroupBox, TWin32WSCustomGroupBox);
|
||||
// RegisterWSComponent(TGroupBox, TWin32WSGroupBox);
|
||||
// RegisterWSComponent(TCustomComboBox, TWin32WSCustomComboBox);
|
||||
RegisterWSComponent(TCustomComboBox, TWin32WSCustomComboBox);
|
||||
// RegisterWSComponent(TComboBox, TWin32WSComboBox);
|
||||
RegisterWSComponent(TCustomListBox, TWin32WSCustomListBox);
|
||||
// RegisterWSComponent(TListBox, TWin32WSListBox);
|
||||
// RegisterWSComponent(TCustomEdit, TWin32WSCustomEdit);
|
||||
RegisterWSComponent(TCustomEdit, TWin32WSCustomEdit);
|
||||
// RegisterWSComponent(TCustomMemo, TWin32WSCustomMemo);
|
||||
// RegisterWSComponent(TEdit, TWin32WSEdit);
|
||||
// RegisterWSComponent(TMemo, TWin32WSMemo);
|
||||
|
@ -107,12 +107,6 @@ const
|
||||
LM_SETITEMINDEX = LM_COMUSER+65;
|
||||
LM_GETSELTEXT = LM_COMUSER+66;
|
||||
LM_SETSELTEXT = LM_COMUSER+67;
|
||||
LM_GETSELSTART = LM_COMUSER+68;
|
||||
LM_SETSELSTART = LM_COMUSER+69;
|
||||
LM_GETSELLEN = LM_COMUSER+70;
|
||||
LM_SETSELLEN = LM_COMUSER+71;
|
||||
LM_GETLIMITTEXT = LM_COMUSER+72;
|
||||
LM_SETLIMITTEXT = LM_COMUSER+73;
|
||||
LM_SORT = LM_COMUSER+74;
|
||||
LM_GETSELCOUNT = LM_COMUSER+75;
|
||||
LM_GETSEL = LM_COMUSER+76;
|
||||
@ -928,12 +922,6 @@ begin
|
||||
LM_SETITEMINDEX :Result:='LM_SETITEMINDEX';
|
||||
LM_GETSELTEXT :Result:='LM_GETSELTEXT';
|
||||
LM_SETSELTEXT :Result:='LM_SETSELTEXT';
|
||||
LM_GETSELSTART :Result:='LM_GETSELSTART';
|
||||
LM_SETSELSTART :Result:='LM_SETSELSTART';
|
||||
LM_GETSELLEN :Result:='LM_GETSELLEN';
|
||||
LM_SETSELLEN :Result:='LM_SETSELLEN';
|
||||
LM_GETLIMITTEXT :Result:='LM_GETLIMITTEXT';
|
||||
LM_SETLIMITTEXT :Result:='LM_SETLIMITTEXT';
|
||||
LM_SORT :Result:='LM_SORT';
|
||||
LM_GETSELCOUNT :Result:='LM_GETSELCOUNT';
|
||||
LM_GETSEL :Result:='LM_GETSEL';
|
||||
@ -1056,6 +1044,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.73 2004/09/07 09:44:46 micha
|
||||
convert lcl messages to new interface using methods: LM_{G,S}ETSELSTART, LM_{G,S}ETSELLEN, LM_{G,S}ETLIMITTEXT
|
||||
|
||||
Revision 1.72 2004/08/30 16:37:58 mattias
|
||||
added OnUTF8KeyPresss
|
||||
|
||||
|
@ -133,6 +133,9 @@ procedure Register;
|
||||
|
||||
Implementation
|
||||
|
||||
uses
|
||||
WSSpin;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Misc',[TSpinEdit]);
|
||||
|
@ -44,7 +44,7 @@ uses
|
||||
// To get as little as posible circles,
|
||||
// uncomment only when needed for registration
|
||||
////////////////////////////////////////////////////
|
||||
// Spin,
|
||||
Spin,
|
||||
////////////////////////////////////////////////////
|
||||
WSLCLClasses, WSControls;
|
||||
|
||||
@ -52,7 +52,15 @@ type
|
||||
{ TWSCustomSpinEdit }
|
||||
|
||||
TWSCustomSpinEdit = class(TWSWinControl)
|
||||
public
|
||||
class function GetSelStart(const ACustomSpinEdit: TCustomSpinEdit): integer; virtual;
|
||||
class function GetSelLength(const ACustomSpinEdit: TCustomSpinEdit): integer; virtual;
|
||||
class function GetValue(const ACustomSpinEdit: TCustomSpinEdit): single; virtual;
|
||||
|
||||
class procedure SetSelStart(const ACustomSpinEdit: TCustomSpinEdit; NewStart: integer); virtual;
|
||||
class procedure SetSelLength(const ACustomSpinEdit: TCustomSpinEdit; NewLength: integer); virtual;
|
||||
end;
|
||||
TWSCustomSpinEditClass = class of TWSCustomSpinEdit;
|
||||
|
||||
{ TWSSpinEdit }
|
||||
|
||||
@ -62,13 +70,38 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
{ TWSCustomSpinEdit }
|
||||
|
||||
function TWSCustomSpinEdit.GetSelStart(const ACustomSpinEdit: TCustomSpinEdit): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function TWSCustomSpinEdit.GetSelLength(const ACustomSpinEdit: TCustomSpinEdit): integer;
|
||||
begin
|
||||
result := 0;
|
||||
end;
|
||||
|
||||
function TWSCustomSpinEdit.GetValue(const ACustomSpinEdit: TCustomSpinEdit): single;
|
||||
begin
|
||||
result := 0.0;
|
||||
end;
|
||||
|
||||
procedure TWSCustomSpinEdit.SetSelStart(const ACustomSpinEdit: TCustomSpinEdit; NewStart: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomSpinEdit.SetSelLength(const ACustomSpinEdit: TCustomSpinEdit; NewLength: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// To improve speed, register only classes
|
||||
// which actually implement something
|
||||
////////////////////////////////////////////////////
|
||||
// RegisterWSComponent(TCustomSpinEdit, TWSCustomSpinEdit);
|
||||
RegisterWSComponent(TCustomSpinEdit, TWSCustomSpinEdit);
|
||||
// RegisterWSComponent(TSpinEdit, TWSSpinEdit);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
|
@ -46,7 +46,7 @@ uses
|
||||
////////////////////////////////////////////////////
|
||||
StdCtrls,
|
||||
////////////////////////////////////////////////////
|
||||
WSLCLClasses, WSControls;
|
||||
WSLCLClasses, WSControls, Classes;
|
||||
|
||||
type
|
||||
{ TWSScrollBar }
|
||||
@ -67,7 +67,21 @@ type
|
||||
{ TWSCustomComboBox }
|
||||
|
||||
TWSCustomComboBox = class(TWSWinControl)
|
||||
public
|
||||
class function GetSelStart(const ACustomComboBox: TCustomComboBox): integer; virtual;
|
||||
class function GetSelLength(const ACustomComboBox: TCustomComboBox): integer; virtual;
|
||||
class function GetItemIndex(const ACustomComboBox: TCustomComboBox): integer; virtual;
|
||||
class function GetMaxLength(const ACustomComboBox: TCustomComboBox): integer; virtual;
|
||||
|
||||
class procedure SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer); virtual;
|
||||
class procedure SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); virtual;
|
||||
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); virtual;
|
||||
class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); virtual;
|
||||
|
||||
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; virtual;
|
||||
class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); virtual;
|
||||
end;
|
||||
TWSCustomComboBoxClass = class of TWSCustomComboBox;
|
||||
|
||||
{ TWSComboBox }
|
||||
|
||||
@ -90,7 +104,14 @@ type
|
||||
{ TWSCustomEdit }
|
||||
|
||||
TWSCustomEdit = class(TWSWinControl)
|
||||
public
|
||||
class function GetSelStart(const ACustomEdit: TCustomEdit): integer; virtual;
|
||||
class function GetSelLength(const ACustomEdit: TCustomEdit): integer; virtual;
|
||||
|
||||
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); virtual;
|
||||
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); virtual;
|
||||
end;
|
||||
TWSCustomEditClass = class of TWSCustomEdit;
|
||||
|
||||
{ TWSCustomMemo }
|
||||
|
||||
@ -161,6 +182,73 @@ procedure TWSCustomListBox.SetStyle(const ACustomListBox: TCustomListBox);
|
||||
begin
|
||||
end;
|
||||
|
||||
{ TWSCustomComboBox }
|
||||
|
||||
function TWSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function TWSCustomComboBox.GetSelLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
result := 0;
|
||||
end;
|
||||
|
||||
function TWSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function TWSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
begin
|
||||
result := 0;
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
function TWSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox): TStrings;
|
||||
begin
|
||||
result := nil;
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
{ TWSCustomEdit }
|
||||
|
||||
function TWSCustomEdit.GetSelStart(const ACustomEdit: TCustomEdit): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function TWSCustomEdit.GetSelLength(const ACustomEdit: TCustomEdit): integer;
|
||||
begin
|
||||
result := 0;
|
||||
end;
|
||||
|
||||
procedure TWSCustomEdit.SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomEdit.SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
@ -170,11 +258,11 @@ initialization
|
||||
// RegisterWSComponent(TScrollBar, TWSScrollBar);
|
||||
// RegisterWSComponent(TCustomGroupBox, TWSCustomGroupBox);
|
||||
// RegisterWSComponent(TGroupBox, TWSGroupBox);
|
||||
// RegisterWSComponent(TCustomComboBox, TWSCustomComboBox);
|
||||
RegisterWSComponent(TCustomComboBox, TWSCustomComboBox);
|
||||
// RegisterWSComponent(TComboBox, TWSComboBox);
|
||||
RegisterWSComponent(TCustomListBox, TWSCustomListBox);
|
||||
// RegisterWSComponent(TListBox, TWSListBox);
|
||||
// RegisterWSComponent(TCustomEdit, TWSCustomEdit);
|
||||
RegisterWSComponent(TCustomEdit, TWSCustomEdit);
|
||||
// RegisterWSComponent(TCustomMemo, TWSCustomMemo);
|
||||
// RegisterWSComponent(TEdit, TWSEdit);
|
||||
// RegisterWSComponent(TMemo, TWSMemo);
|
||||
|
Loading…
Reference in New Issue
Block a user