fixed TStringGrid goEditing from Jesus

git-svn-id: trunk@5601 -
This commit is contained in:
mattias 2004-06-27 09:34:24 +00:00
parent 269377f97f
commit e85b004b32
4 changed files with 40 additions and 23 deletions

View File

@ -3484,7 +3484,9 @@ begin
EditorSelectAll;
//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
///
@ -3495,6 +3497,8 @@ begin
if Ch=^H then Msg.Value:=''
else Msg.Value:=ch;
FEditor.Dispatch(Msg);
{$endif}
end;
end;

View File

@ -26,20 +26,21 @@ type
end;
PCustomListBoxItemRecord = ^TCustomListBoxItemRecord;
{------------------------------------------------------------------------------}
{ procedure TCustomListBox.AssignCacheToItemData }
{------------------------------------------------------------------------------}
procedure TCustomListBox.AssignCacheToItemData(const AIndex: Integer; const AData: Pointer);
{------------------------------------------------------------------------------
procedure TCustomListBox.AssignCacheToItemData
------------------------------------------------------------------------------}
procedure TCustomListBox.AssignCacheToItemData(const AIndex: Integer;
const AData: Pointer);
begin
if PCustomListBoxItemRecord(AData)^.Selected
or (FItemIndex = AIndex)
then SendItemSelected(AIndex, True);
if PCustomListBoxItemRecord(AData)^.Selected or (FItemIndex = AIndex) then
SendItemSelected(AIndex, True);
end;
{------------------------------------------------------------------------------}
{ procedure TCustomListBox.AssignItemDataToCache }
{------------------------------------------------------------------------------}
procedure TCustomListBox.AssignItemDataToCache(const AIndex: Integer; const AData: Pointer);
{------------------------------------------------------------------------------
procedure TCustomListBox.AssignItemDataToCache
------------------------------------------------------------------------------}
procedure TCustomListBox.AssignItemDataToCache(const AIndex: Integer;
const AData: Pointer);
begin
PCustomListBoxItemRecord(AData)^.Selected := Selected[AIndex];
end;
@ -369,9 +370,9 @@ end;
{------------------------------------------------------------------------------}
{ function TCustomListBox.Create }
{------------------------------------------------------------------------------}
constructor TCustomListBox.Create(AOwner : TComponent);
constructor TCustomListBox.Create(TheOwner : TComponent);
begin
inherited Create(AOwner);
inherited Create(TheOwner);
fCompStyle := csListBox;
BorderStyle:= bsSingle;
FItems := TExtendedStringList.Create(GetCachedDataSize);

View File

@ -322,6 +322,7 @@ begin
// Disadvantages: - worst case on sorted list
// - not keeping order
// ToDo: replace by mergesort and add customsort
// remember selected items
Assign(sl);
sl.Free;
EndUpdate;
@ -357,14 +358,12 @@ end;
procedure TGtkListStringList.BeginUpdate;
begin
if FUpdateCount=0 then Include(FStates,glsItemCacheNeedsUpdate);
inc(FUpdateCount);
end;
procedure TGtkListStringList.EndUpdate;
begin
dec(FUpdateCount);
if FUpdateCount=0 then Include(FStates,glsItemCacheNeedsUpdate);
end;
{------------------------------------------------------------------------------
@ -537,12 +536,14 @@ var
li, cb, box: PGtkWidget;
l, m, r, cmp: integer;
item_requisition: TGtkRequisition;
OldCount: LongInt;
begin
OldCount:=Count;
BeginUpdate;
try
if FSorted then begin
l:=0;
r:=Count-1;
r:=OldCount-1;
m:=l;
while (l<=r) do begin
m:=(l+r) shr 1;
@ -554,13 +555,13 @@ begin
else
break;
end;
if (m<Count) and (AnsiCompareText(S,Strings[m])>0) then
if (m<OldCount) and (AnsiCompareText(S,Strings[m])>0) then
inc(m);
Index:=m;
end;
if (Index < 0) or (Index > Count) then
if (Index < 0) or (Index > OldCount) then
RaiseException('TGtkListStringList.Insert: Index '+IntToStr(Index)
+' out of bounds. Count='+IntToStr(Count));
+' out of bounds. Count='+IntToStr(OldCount));
if Owner = nil then RaiseException(
'TGtkListStringList.Insert Unspecified owner');
@ -581,7 +582,11 @@ begin
li:=gtk_list_item_new_with_label(PChar(S));
end;
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_list_insert_items(FGtkList, g_list_append(nil, li), Index);
if (Owner is TCustomListBox)
@ -781,6 +786,9 @@ end;
{ =============================================================================
$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
replaced writeln by debugln

View File

@ -345,7 +345,8 @@ type
TCustomListBox = class(TWinControl)
private
FCanvas: TCanvas;
FExtendedSelect, FMultiSelect : boolean;
FExtendedSelect: boolean;
FMultiSelect: boolean;
FIntegralHeight: boolean;
FItems: TStrings;
FItemHeight: Integer;
@ -388,7 +389,7 @@ type
property OnMeasureItem: TMeasureItemEvent
read FOnMeasureItem write FOnMeasureItem;
public
constructor Create(AOwner : TComponent); override;
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function GetIndexAtY(Y: integer): integer;
function ItemAtPos(const Pos: TPoint; Existing: Boolean): Integer;
@ -1558,6 +1559,9 @@ end.
{ =============================================================================
$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
fix designer cursor to not set Form.Cursor directly