mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 09:49:22 +02:00
fixed TStringGrid goEditing from Jesus
git-svn-id: trunk@5601 -
This commit is contained in:
parent
269377f97f
commit
e85b004b32
@ -3484,7 +3484,9 @@ begin
|
|||||||
EditorSelectAll;
|
EditorSelectAll;
|
||||||
//DebugLn('Posting editor LM_CHAR, ch=',ch, ' ', InttoStr(Ord(ch)));
|
//DebugLn('Posting editor LM_CHAR, ch=',ch, ' ', InttoStr(Ord(ch)));
|
||||||
|
|
||||||
//PostMessage(FEditor.Handle, LM_CHAR, Word(Ch), 0);
|
{$ifdef WIN32}
|
||||||
|
PostMessage(FEditor.Handle, LM_CHAR, Word(Ch), 0);
|
||||||
|
{$else}
|
||||||
///
|
///
|
||||||
// Note. this is a workaround because the call above doesn't work
|
// Note. this is a workaround because the call above doesn't work
|
||||||
///
|
///
|
||||||
@ -3495,6 +3497,8 @@ begin
|
|||||||
if Ch=^H then Msg.Value:=''
|
if Ch=^H then Msg.Value:=''
|
||||||
else Msg.Value:=ch;
|
else Msg.Value:=ch;
|
||||||
FEditor.Dispatch(Msg);
|
FEditor.Dispatch(Msg);
|
||||||
|
{$endif}
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -26,20 +26,21 @@ type
|
|||||||
end;
|
end;
|
||||||
PCustomListBoxItemRecord = ^TCustomListBoxItemRecord;
|
PCustomListBoxItemRecord = ^TCustomListBoxItemRecord;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------
|
||||||
{ procedure TCustomListBox.AssignCacheToItemData }
|
procedure TCustomListBox.AssignCacheToItemData
|
||||||
{------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCustomListBox.AssignCacheToItemData(const AIndex: Integer; const AData: Pointer);
|
procedure TCustomListBox.AssignCacheToItemData(const AIndex: Integer;
|
||||||
|
const AData: Pointer);
|
||||||
begin
|
begin
|
||||||
if PCustomListBoxItemRecord(AData)^.Selected
|
if PCustomListBoxItemRecord(AData)^.Selected or (FItemIndex = AIndex) then
|
||||||
or (FItemIndex = AIndex)
|
SendItemSelected(AIndex, True);
|
||||||
then SendItemSelected(AIndex, True);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------
|
||||||
{ procedure TCustomListBox.AssignItemDataToCache }
|
procedure TCustomListBox.AssignItemDataToCache
|
||||||
{------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCustomListBox.AssignItemDataToCache(const AIndex: Integer; const AData: Pointer);
|
procedure TCustomListBox.AssignItemDataToCache(const AIndex: Integer;
|
||||||
|
const AData: Pointer);
|
||||||
begin
|
begin
|
||||||
PCustomListBoxItemRecord(AData)^.Selected := Selected[AIndex];
|
PCustomListBoxItemRecord(AData)^.Selected := Selected[AIndex];
|
||||||
end;
|
end;
|
||||||
@ -369,9 +370,9 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ function TCustomListBox.Create }
|
{ function TCustomListBox.Create }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
constructor TCustomListBox.Create(AOwner : TComponent);
|
constructor TCustomListBox.Create(TheOwner : TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(TheOwner);
|
||||||
fCompStyle := csListBox;
|
fCompStyle := csListBox;
|
||||||
BorderStyle:= bsSingle;
|
BorderStyle:= bsSingle;
|
||||||
FItems := TExtendedStringList.Create(GetCachedDataSize);
|
FItems := TExtendedStringList.Create(GetCachedDataSize);
|
||||||
|
@ -322,6 +322,7 @@ begin
|
|||||||
// Disadvantages: - worst case on sorted list
|
// Disadvantages: - worst case on sorted list
|
||||||
// - not keeping order
|
// - not keeping order
|
||||||
// ToDo: replace by mergesort and add customsort
|
// ToDo: replace by mergesort and add customsort
|
||||||
|
// remember selected items
|
||||||
Assign(sl);
|
Assign(sl);
|
||||||
sl.Free;
|
sl.Free;
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
@ -357,14 +358,12 @@ end;
|
|||||||
|
|
||||||
procedure TGtkListStringList.BeginUpdate;
|
procedure TGtkListStringList.BeginUpdate;
|
||||||
begin
|
begin
|
||||||
if FUpdateCount=0 then Include(FStates,glsItemCacheNeedsUpdate);
|
|
||||||
inc(FUpdateCount);
|
inc(FUpdateCount);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtkListStringList.EndUpdate;
|
procedure TGtkListStringList.EndUpdate;
|
||||||
begin
|
begin
|
||||||
dec(FUpdateCount);
|
dec(FUpdateCount);
|
||||||
if FUpdateCount=0 then Include(FStates,glsItemCacheNeedsUpdate);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -537,12 +536,14 @@ var
|
|||||||
li, cb, box: PGtkWidget;
|
li, cb, box: PGtkWidget;
|
||||||
l, m, r, cmp: integer;
|
l, m, r, cmp: integer;
|
||||||
item_requisition: TGtkRequisition;
|
item_requisition: TGtkRequisition;
|
||||||
|
OldCount: LongInt;
|
||||||
begin
|
begin
|
||||||
|
OldCount:=Count;
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
try
|
try
|
||||||
if FSorted then begin
|
if FSorted then begin
|
||||||
l:=0;
|
l:=0;
|
||||||
r:=Count-1;
|
r:=OldCount-1;
|
||||||
m:=l;
|
m:=l;
|
||||||
while (l<=r) do begin
|
while (l<=r) do begin
|
||||||
m:=(l+r) shr 1;
|
m:=(l+r) shr 1;
|
||||||
@ -554,13 +555,13 @@ begin
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
if (m<Count) and (AnsiCompareText(S,Strings[m])>0) then
|
if (m<OldCount) and (AnsiCompareText(S,Strings[m])>0) then
|
||||||
inc(m);
|
inc(m);
|
||||||
Index:=m;
|
Index:=m;
|
||||||
end;
|
end;
|
||||||
if (Index < 0) or (Index > Count) then
|
if (Index < 0) or (Index > OldCount) then
|
||||||
RaiseException('TGtkListStringList.Insert: Index '+IntToStr(Index)
|
RaiseException('TGtkListStringList.Insert: Index '+IntToStr(Index)
|
||||||
+' out of bounds. Count='+IntToStr(Count));
|
+' out of bounds. Count='+IntToStr(OldCount));
|
||||||
if Owner = nil then RaiseException(
|
if Owner = nil then RaiseException(
|
||||||
'TGtkListStringList.Insert Unspecified owner');
|
'TGtkListStringList.Insert Unspecified owner');
|
||||||
|
|
||||||
@ -581,7 +582,11 @@ begin
|
|||||||
li:=gtk_list_item_new_with_label(PChar(S));
|
li:=gtk_list_item_new_with_label(PChar(S));
|
||||||
end;
|
end;
|
||||||
ConnectItemCallbacks(PGtkListItem(li));
|
ConnectItemCallbacks(PGtkListItem(li));
|
||||||
Include(FStates,glsItemCacheNeedsUpdate);
|
ReAllocMem(FCachedItems,SizeOf(PGtkListItem)*(OldCount+1));
|
||||||
|
if Index<OldCount then
|
||||||
|
System.Move(FCachedItems[Index],FCachedItems[Index+1],
|
||||||
|
SizeOf(PGtkListItem)*(OldCount-Index));
|
||||||
|
FCachedItems[Index]:=PGtkListItem(li);
|
||||||
gtk_widget_show_all(li);
|
gtk_widget_show_all(li);
|
||||||
gtk_list_insert_items(FGtkList, g_list_append(nil, li), Index);
|
gtk_list_insert_items(FGtkList, g_list_append(nil, li), Index);
|
||||||
if (Owner is TCustomListBox)
|
if (Owner is TCustomListBox)
|
||||||
@ -781,6 +786,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.24 2004/06/27 09:34:24 mattias
|
||||||
|
fixed TStringGrid goEditing from Jesus
|
||||||
|
|
||||||
Revision 1.23 2004/05/11 12:16:47 mattias
|
Revision 1.23 2004/05/11 12:16:47 mattias
|
||||||
replaced writeln by debugln
|
replaced writeln by debugln
|
||||||
|
|
||||||
|
@ -345,7 +345,8 @@ type
|
|||||||
TCustomListBox = class(TWinControl)
|
TCustomListBox = class(TWinControl)
|
||||||
private
|
private
|
||||||
FCanvas: TCanvas;
|
FCanvas: TCanvas;
|
||||||
FExtendedSelect, FMultiSelect : boolean;
|
FExtendedSelect: boolean;
|
||||||
|
FMultiSelect: boolean;
|
||||||
FIntegralHeight: boolean;
|
FIntegralHeight: boolean;
|
||||||
FItems: TStrings;
|
FItems: TStrings;
|
||||||
FItemHeight: Integer;
|
FItemHeight: Integer;
|
||||||
@ -388,7 +389,7 @@ type
|
|||||||
property OnMeasureItem: TMeasureItemEvent
|
property OnMeasureItem: TMeasureItemEvent
|
||||||
read FOnMeasureItem write FOnMeasureItem;
|
read FOnMeasureItem write FOnMeasureItem;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner : TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function GetIndexAtY(Y: integer): integer;
|
function GetIndexAtY(Y: integer): integer;
|
||||||
function ItemAtPos(const Pos: TPoint; Existing: Boolean): Integer;
|
function ItemAtPos(const Pos: TPoint; Existing: Boolean): Integer;
|
||||||
@ -1558,6 +1559,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.149 2004/06/27 09:34:23 mattias
|
||||||
|
fixed TStringGrid goEditing from Jesus
|
||||||
|
|
||||||
Revision 1.148 2004/06/14 12:54:02 micha
|
Revision 1.148 2004/06/14 12:54:02 micha
|
||||||
fix designer cursor to not set Form.Cursor directly
|
fix designer cursor to not set Form.Cursor directly
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user