Jump to content

Recommended Posts

Posted

Hi Farshad!

 

I tried to make a sortable items list (using StringGrid) with toggable items, and encountered several errors. It works in VCL (though has some visual glitches), but not in WEB. Test case is in attachment, also added some comments there.

test1.zip

  • Administrators
Posted

Hi Farshad!

 

I tried to make a sortable items list (using StringGrid) with toggable items, and encountered several errors. It works in VCL (though has some visual glitches), but not in WEB. Test case is in attachment, also added some comments there.

 

What are those errors exactly? I can only see problem with toggling.

Posted

What are those errors exactly? I can only see problem with toggling.

 

When I change font color in DrawCell event, seems like background is set to white (cursor disappears) and grid starts to lag a lot. The only reason you don't see this because I manually change Attribs.Color := clWindow. Just comment it out and try.

And how can I rehresh grid in WEB mode when I toggle items? Refresh method doesn't work.

  • Administrators
Posted

When I change font color in DrawCell event, seems like background is set to white (cursor disappears) and grid starts to lag a lot. The only reason you don't see this because I manually change Attribs.Color := clWindow. Just comment it out and try.

And how can I rehresh grid in WEB mode when I toggle items? Refresh method doesn't work.

 

procedure TMainForm.btnDownClick(Sender: TObject);
var
 s: string;
 item: TItem;
begin
 if sg.Row = sg.RowCount - 1 then Exit;

 lst.Exchange(sg.Row, sg.Row + 1);   // Call it here

 s := sg.Cells[0, sg.Row+1]; sg.Cells[0, sg.Row+1] := sg.Cells[0, sg.Row]; sg.Cells[0, sg.Row] := s;
 s := sg.Cells[1, sg.Row+1]; sg.Cells[1, sg.Row+1] := sg.Cells[1, sg.Row]; sg.Cells[1, sg.Row] := s;
 s := sg.Cells[2, sg.Row+1]; sg.Cells[2, sg.Row+1] := sg.Cells[2, sg.Row]; sg.Cells[2, sg.Row] := s;
 sg.Row := sg.Row + 1;
 sg.SetFocus;
end;

 

Change click event as above. You need to exchange rows before you change cell contents because uniGUI assigns new attributes when you assign a new value to Cell[x,y].

Do same thing for up event.

 

procedure TMainForm.btnToggleClick(Sender: TObject);
begin
 TItem(lst[sg.Row]).sel := not TItem(lst[sg.Row]).sel;
 sg.RefreshRow;
end;

 

I implemented RefreshRow method.

×
×
  • Create New...