Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 20 Apr 2024, 01:44

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 18 Jul 2018, 06:03 
Offline

Joined: 31 Jan 2013, 13:05
Posts: 17
I don't know oif ehlib have this option, or something alternative. I want to design the grid aspect and fields, save in design the structure of the grid in external file and on run dynamic load this extern file structure of the grid, and after load with data...i have something with DBALTGRID from quasidata (Saving and loading a grid properties to and from a text file, a stream, a resource file/compiled resource, or the system registry)but old component...Builder c++ 6

I need a methot to save AT DESIGN TIME the proprieties of the grid in INI file and restore AT DESIGN TIME another INI file, save before, with another structure!!!

ex of extern ehgrid...
object DBGridEh: TDBGridEh
Left = 0
Top = 26
Width = 723
Height = 378
Hint = 'Click dreapta pentru meniul de actualizare'
Align = alTop
DataGrouping.GroupLevels = <>
DataSource = dsRaportor
Flat = True
Font.Charset = EASTEUROPE_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = []
FooterColor = 15856120
FooterFont.Charset = DEFAULT_CHARSET
FooterFont.Color = clWindowText
FooterFont.Height = -11
FooterFont.Name = 'MS Sans Serif'
FooterFont.Style = []
FooterRowCount = 1
IndicatorOptions = [gioShowRowIndicatorEh]
Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit]
OptionsEh = [dghFixed3D, dghFooter3D, dghData3D, dghHighlightFocus, dghClearSelection, dghFitRowHeightToText, dghIncSearch, dghPreferIncSearch, dghRowHighlight, dghColumnResize, dghColumnMove]
ParentFont = False
ParentShowHint = False
PopupMenu = PopupMenuGP
ReadOnly = True
RowHeight = 2
RowLines = 1
ShowHint = True
SumList.Active = True
TabOrder = 0
TitleFont.Charset = EASTEUROPE_CHARSET
TitleFont.Color = clNavy
TitleFont.Height = -12
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = [fsBold]
TitleLines = 1
UseMultiTitle = True
OnDblClick = DBGridEhDblClick
OnKeyPress = DBGridEhKeyPress
Columns = <
item
EditButtons = <>
FieldName = 'CODCER'
Footers = <>
Title.Caption = 'Cod'
Title.TitleButton = True
Width = 103
end
item
EditButtons = <>
FieldName = 'DENCER'
Footers = <>
Title.Caption = 'Denumire'
Title.TitleButton = True
Width = 292
end
item
EditButtons = <>
FieldName = 'ACTCER'
Footers = <>
Title.Caption = 'Activ'
Title.TitleButton = True
Width = 75
end
item
EditButtons = <>
FieldName = 'GRPTXI'
Footers = <>
Title.TitleButton = True
Width = 78
end
item
EditButtons = <>
FieldName = 'GRPSPC'
Footers = <>
Title.TitleButton = True
Width = 71
end>
object RowDetailData: TRowDetailPanelControlEh
end
end


Top
 Profile  
 
PostPosted: 26 Jul 2018, 21:58 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Hello

You can write published properties of DBGridEh to string using next code

Code:
procedure TForm1.Button1Click(Sender: TObject);
var
  ms: TMemoryStream;
  ss: TStringStream;
  s: String;
begin
  ms := TMemoryStream.Create;
  ss := TStringStream.Create('');
  ms.WriteComponent(DBGridEh1);
  ms.Position := 0;
  ObjectBinaryToText(ms, ss);
  DBMemoEh1.Text := ss.DataString; // then write down the text where you want
  ms.Free;
  ss.Free;
end;

then write down the text where you want

same for read from text to DBGridEh

Code:
procedure TForm1.Button2Click(Sender: TObject);
var
  ms: TMemoryStream;
  ss: TStringStream;
begin
  ms := TMemoryStream.Create;
  ss := TStringStream.Create(DBMemoEh1.Text);
  ObjectTextToBinary(ss, ms);
  ms.Position := 0;
  ms.ReadComponent(DBGridEh1);
  ms.Free;
  ss.Free;
end;

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group