mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 01:09:39 +02:00
added TComboBox.ReadOnly - only partially working under gtk1
git-svn-id: trunk@7546 -
This commit is contained in:
parent
e053f1f051
commit
862a04296b
@ -46,9 +46,9 @@ begin
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetItemIndex(Self, FItemIndex);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetStyle(Self, FStyle);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetArrowKeysTraverseList(Self, FArrowKeysTraverseList);
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetReadOnly(Self, FReadOnly);
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TCustomComboBox.DestroyWnd
|
||||
Params: ---
|
||||
@ -213,7 +213,8 @@ end;
|
||||
procedure TCustomComboBox.CloseUp;
|
||||
begin
|
||||
if [csLoading,csDestroying,csDesigning]*ComponentState<>[] then exit;
|
||||
EditingDone;
|
||||
if not ReadOnly then
|
||||
EditingDone;
|
||||
if Assigned(FOnCloseUp) then FOnCloseUp(Self);
|
||||
end;
|
||||
|
||||
@ -376,7 +377,7 @@ procedure TCustomComboBox.WMChar(var Message: TLMChar);
|
||||
begin
|
||||
// all normal characters are handled by the ComboBox
|
||||
//debugln('TCustomEdit.WMChar ',DbgSName(Self),' ',dbgs(Message.CharCode));
|
||||
if Message.CharCode in [ord('A')..ord('Z'),ord('a')..ord('z')] then
|
||||
if (Message.CharCode in [ord('A')..ord('Z'),ord('a')..ord('z')]) then
|
||||
// eat normal keys, so they don't trigger accelerators
|
||||
Message.Result := 1
|
||||
else
|
||||
@ -817,6 +818,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomComboBox.SetReadOnly(const AValue: Boolean);
|
||||
begin
|
||||
if FReadOnly=AValue then exit;
|
||||
FReadOnly:=AValue;
|
||||
if HandleAllocated then
|
||||
TWSCustomComboBoxClass(WidgetSetClass).SetReadOnly(Self, AValue);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TCustomComboBox.UpdateSorted;
|
||||
------------------------------------------------------------------------------}
|
||||
|
@ -84,7 +84,8 @@ type
|
||||
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); override;
|
||||
class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); override;
|
||||
class procedure SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); override;
|
||||
|
||||
class procedure SetReadOnly(const ACustomComboBox: TCustomComboBox; NewReadOnly: boolean); override;
|
||||
|
||||
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; override;
|
||||
class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); override;
|
||||
end;
|
||||
@ -692,6 +693,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGtkWSCustomComboBox.SetReadOnly(const ACustomComboBox: TCustomComboBox;
|
||||
NewReadOnly: boolean);
|
||||
var
|
||||
Widget: PGtkWidget;
|
||||
begin
|
||||
Widget:=PGtkCombo(ACustomComboBox.Handle)^.entry;
|
||||
if GtkWidgetIsA(Widget,{$ifdef GTK1}GTK_ENTRY_TYPE{$else}GTK_TYPE_ENTRY{$endif}) then
|
||||
gtk_entry_set_editable(PGtkEntry(Widget), not ACustomComboBox.ReadOnly);
|
||||
end;
|
||||
|
||||
function TGtkWSCustomComboBox.GetItems(
|
||||
const ACustomComboBox: TCustomComboBox): TStrings;
|
||||
begin
|
||||
|
@ -238,6 +238,7 @@ type
|
||||
FOnDropDown: TNotifyEvent;
|
||||
FOnMeasureItem: TMeasureItemEvent;
|
||||
FOnSelect: TNotifyEvent;
|
||||
FReadOnly: Boolean;
|
||||
FSelLength: integer;
|
||||
FSelStart: integer;
|
||||
FSorted: boolean;
|
||||
@ -251,6 +252,7 @@ type
|
||||
procedure LMDrawListItem(var TheMessage: TLMDrawListItem); message LM_DrawListItem;
|
||||
procedure LMMeasureItem(var TheMessage: TLMMeasureItem); message LM_MeasureItem;
|
||||
procedure CNCommand(var TheMessage: TLMCommand); message CN_Command;
|
||||
procedure SetReadOnly(const AValue: Boolean);
|
||||
procedure UpdateSorted;
|
||||
procedure SetArrowKeysTraverseList(Value: Boolean);
|
||||
procedure WMChar(var Message: TLMChar); message LM_CHAR;
|
||||
@ -258,7 +260,7 @@ type
|
||||
procedure CreateWnd; override;
|
||||
procedure DestroyWnd; override;
|
||||
procedure DrawItem(Index: Integer; ARect: TRect;
|
||||
State: TOwnerDrawState); virtual;
|
||||
State: TOwnerDrawState); virtual;
|
||||
procedure LMChange(var msg); message LM_CHANGED;
|
||||
procedure Change; dynamic;
|
||||
procedure Select; dynamic;
|
||||
@ -321,6 +323,7 @@ type
|
||||
property Canvas: TCanvas read FCanvas;
|
||||
property Items: TStrings read FItems write SetItems;
|
||||
property ItemIndex: integer read GetItemIndex write SetItemIndex default -1;
|
||||
property ReadOnly: Boolean read FReadOnly write SetReadOnly default false;
|
||||
property SelLength: integer read GetSelLength write SetSelLength;
|
||||
property SelStart: integer read GetSelStart write SetSelStart;
|
||||
property SelText: String read GetSelText write SetSelText;
|
||||
@ -370,6 +373,7 @@ type
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ReadOnly;
|
||||
property ShowHint;
|
||||
property Sorted;
|
||||
property Style;
|
||||
|
@ -81,6 +81,7 @@ type
|
||||
class procedure SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer); virtual;
|
||||
class procedure SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer); virtual;
|
||||
class procedure SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle); virtual;
|
||||
class procedure SetReadOnly(const ACustomComboBox: TCustomComboBox; NewReadOnly: boolean); virtual;
|
||||
|
||||
class function GetItems(const ACustomComboBox: TCustomComboBox): TStrings; virtual;
|
||||
class procedure Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean); virtual;
|
||||
@ -251,67 +252,85 @@ procedure TWSCustomListBox.SetStyle(const ACustomListBox: TCustomListBox);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomListBox.SetSorted(const ACustomListBox: TCustomListBox; AList: TStrings; ASorted: boolean);
|
||||
procedure TWSCustomListBox.SetSorted(const ACustomListBox: TCustomListBox;
|
||||
AList: TStrings; ASorted: boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomListBox.SetTopIndex(const ACustomListBox: TCustomListBox; const NewTopIndex: integer);
|
||||
procedure TWSCustomListBox.SetTopIndex(const ACustomListBox: TCustomListBox;
|
||||
const NewTopIndex: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
{ TWSCustomComboBox }
|
||||
|
||||
function TWSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox): integer;
|
||||
function TWSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox
|
||||
): integer;
|
||||
begin
|
||||
result := -1;
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function TWSCustomComboBox.GetSelLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
function TWSCustomComboBox.GetSelLength(const ACustomComboBox: TCustomComboBox
|
||||
): integer;
|
||||
begin
|
||||
result := 0;
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TWSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox): integer;
|
||||
function TWSCustomComboBox.GetItemIndex(const ACustomComboBox: TCustomComboBox
|
||||
): integer;
|
||||
begin
|
||||
result := -1;
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
function TWSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox): integer;
|
||||
function TWSCustomComboBox.GetMaxLength(const ACustomComboBox: TCustomComboBox
|
||||
): integer;
|
||||
begin
|
||||
result := 0;
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetArrowKeysTraverseList(const ACustomComboBox: TCustomComboBox;
|
||||
NewTraverseList: boolean);
|
||||
procedure TWSCustomComboBox.SetArrowKeysTraverseList(
|
||||
const ACustomComboBox: TCustomComboBox; NewTraverseList: boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox; NewLength: integer);
|
||||
procedure TWSCustomComboBox.SetMaxLength(const ACustomComboBox: TCustomComboBox;
|
||||
NewLength: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetSelStart(const ACustomComboBox: TCustomComboBox; NewStart: integer);
|
||||
procedure TWSCustomComboBox.SetSelStart(const ACustomComboBox: TCustomComboBox;
|
||||
NewStart: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetSelLength(const ACustomComboBox: TCustomComboBox; NewLength: integer);
|
||||
procedure TWSCustomComboBox.SetSelLength(const ACustomComboBox: TCustomComboBox;
|
||||
NewLength: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetItemIndex(const ACustomComboBox: TCustomComboBox; NewIndex: integer);
|
||||
procedure TWSCustomComboBox.SetItemIndex(const ACustomComboBox: TCustomComboBox;
|
||||
NewIndex: integer);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.SetStyle(const ACustomComboBox: TCustomComboBox; NewStyle: TComboBoxStyle);
|
||||
procedure TWSCustomComboBox.SetStyle(const ACustomComboBox: TCustomComboBox;
|
||||
NewStyle: TComboBoxStyle);
|
||||
begin
|
||||
end;
|
||||
|
||||
function TWSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox): TStrings;
|
||||
procedure TWSCustomComboBox.SetReadOnly(const ACustomComboBox: TCustomComboBox;
|
||||
NewReadOnly: boolean);
|
||||
begin
|
||||
result := nil;
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox; AList: TStrings; IsSorted: boolean);
|
||||
function TWSCustomComboBox.GetItems(const ACustomComboBox: TCustomComboBox
|
||||
): TStrings;
|
||||
begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure TWSCustomComboBox.Sort(const ACustomComboBox: TCustomComboBox;
|
||||
AList: TStrings; IsSorted: boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user