Re: [Lazarus] How TDBGrid works

2016-05-07 Thread Jesus Reyes A.
En Sat, 07 May 2016 01:26:38 -0500, Martin Schreiber   
escribió:



On Friday 06 May 2016 23:20:41 Aradeonas wrote:

Thanks.

So what is the best way to provide those 100 to 1100 record at least
without Dataset calling AfterScroll event?
I want to not make any event while scrolling my custom Grid so other
connected DB controls change their values otherwise while Im scrolling
my custom grid it will cause calling all connected DB controls to update
their values.
I hope it is more clear now.


If the wanted record is in window of TDataLink.FirstRecord..FirstRecord +
BufferCount - 1 you can temporarily switch the record which supplies the
field data by setting TDatalink.ActiveRecord which doesn't fire any  
events. I

assume you know that. ;-)
See for example the MSEgui functions TGridDatalink.GetDisplay*Buffer(),
BeginGridRow() and EndGridRow().
https://gitlab.com/mseide-msegui/mseide-msegui/raw/master/lib/common/db/msedbedit.pas



Good luck by trying that while FirstRecord is "pointing" to record 1000  
AND keeping RecNo at 1, maybe I misunderstood something.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How TDBGrid works

2016-05-06 Thread Jesus Reyes A.
En Fri, 06 May 2016 16:20:41 -0500, Aradeonas   
escribió:



Thanks.


So what is the best way to provide those 100 to 1100 record at least  
without Dataset calling >AfterScroll event?


I want to not make any event while scrolling my custom Grid so other  
connected DB controls change >their values otherwise while Im scrolling  
my custom grid it will cause calling all connected DB >controls to  
update their values.


I hope it is more clear now.

Regards,

Ara


The easy one is probably to make two independent connections to the  
database. More elaborated solutions would be for example copy all said  
records to a memdataset and only connect that to a dbgrid, OR put the  
records in a non-dataset enabled component, like a TDrawGrid or  
TStringGrid, browsing that will not trigger any dataset events so other db  
controls will be unaffected, etc. The problem here is I think  
synchronizing stuff, you will have a funny time getting the updates to  
those records into the original source.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Flexible exporter for grid-like components

2016-05-06 Thread Jesus Reyes A.

En Fri, 06 May 2016 15:51:41 -0500, Bart  escribió:


On 5/6/16, Werner Pamler  wrote:
...
About writing a patch:
Don't you have svn commit (to LCL)?
If so, just commit it, since nobody seems to object to the basic
philosophy of your idea and implementation.
Once committed, others will participate.



+1

I would only suggest to keep the new units to a minimum, or if two units  
are needed name the grid related code as gridutils.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How TDBGrid works

2016-05-06 Thread Jesus Reyes A.
On Fri, 06 May 2016 15:07:18 -0500, Aradeonas   
wrote:



Thanks, It seems I should explain better.
For RecordCount you are right and it seems DBGrid doesn't know correct  
number either otherwise it should has a better scroll size.
I want to do something like DBGrid and for that I want to get only a  
part of data for example record 1000 to 1100 and for that I can >set  
BufferCount to 100 but in this case I should navigate dataset to record  
1000 to get these value but I prefer to not change RecNo >and use  
something like DataLink's ActiveRecord that changes record you want  
without changing RecNo of Dataset.




You can't, there is no way using TDataset facilities. But anyway, changing  
ActiveRecord *should* change RecNo (provided that RecNo is reliable, it  
definitively is not if Dataset.IsSequenced=false OR dataset is filtered),  
if it's not then you found a bug.


So if I have 1 Dataset that is fully load all 1500 record can I just  
print records from 1000 to 1100 without changing RecNo?

Regards,
Ara



Jesus Reyes A.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How TDBGrid works

2016-05-06 Thread Jesus Reyes A.
On Fri, 06 May 2016 13:44:46 -0500, Aradeonas   
wrote:


Jesus,In that demo if I set BufferCount to 9 always get 9 records and  
even Query.RecordCount will be 9 even result is more.
How can I get real count? I can get count before setting the link but is  
it the best way?


DbGrid does not do that, and it doesn't have to. And the best way would  
depend, I guess, on the specific situation and what set of components are  
being used.




How can I move or scroll link without moving Query? I want to scroll the  
grid and get new data without changing RecNo.
In your example if I only got 9 record for example but I want for  
example 20th record.




Not sure if I understand the part on "moving the query", but using  
TDataset derived components, and without using the basic MoveBy, Locate,  
first, last, next or prev you can't. Some dataset descendants may have  
some properties that help at some cost, for example y you set  
PacketRecords:=-1 then sqldb will load all the records and in this case  
RecordCount may be reliable, that is if dataset is not filtered (or that  
seems to indicate the relevant documentation). Some datasets may actually  
return a valid record count, probably TDbf is in this case. In any case  
without using the mentioned basic operations you can't select records.



Regards,
Ara



Jesus Reyes A.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How TDBGrid works

2016-05-05 Thread Jesus Reyes A.
En Thu, 05 May 2016 16:53:00 -0500, Aradeonas   
escribió:



Hi,
I'm curious about how TDBGrid now what to show in a column as value.
I mean if I want to make a custom grid simple solution si going from  
first to last of TDataset and read columns value.
I Browsed TDBGrid code lately but sadly I couldnt find how it works to  
get data without (as I think) browsing and changing TDataset records.

Regards,
Ara
--http://www.fastmail.com - Send your email first class


DBGrid does not read all records from first to last in order to show them,  
it only "specify" how many records it can show at the same time, it does  
this using a data link, TComponentDatalink, which is just a TDatalink with  
some custom dataset events for easy hooking, a data link is an  
intermediary between the grid and the dataset. So once the amount of  
records is set, the grid uses a datalink property: ActiveRecord in order  
to select which record from the ones it has reserved is the active record,  
then DbGrid maps this active record to the grid.Row property, the grid.Col  
property is mapped to a field index and using the standard dataset  
properties like Fields[i] or the field associated to a column which is  
again just taken from the dataset.


The dataset is in charge all the time in keeping the reserved records up  
to date, the grid just shows the values it finds in the records.


The starting point when the records are shown in DbGrid is procedure  
TCustomDBGrid.DrawAllRows; there the ActiveRecord is selected, DrawAllRows  
eventually ends calling  individual cells for each row which does  
DefaultDrawCell and several others.


In bug report http://bugs.freepascal.org/view.php?id=29764 I put an  
example of using TDatalink with multiple records and without DbGrid in a  
console program. Hope that helps.


Jesus Reyes A.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] EasyLazFreeType demo not working

2016-04-09 Thread Jesus Reyes A.
En Sat, 09 Apr 2016 12:50:42 -0500, Ondrej Pokorny   
escribió:


I test the EasyLazFreeType from lazutils package. I cannot make the  
example work (in directory examples\lazfreetype).


The actual problem is in TFreeTypeFont.LoadFace line "familyItem :=  
Collection.Family[FName];" where Collection is nil (the FontCollection  
global variable in EasyLazFreeType is nil).
I downloaded all font files and placed them into the directory, they are  
correctly loaded.


Can somebody help? :)

Ondrej



It runs here if I give to it three arguments in command line, example:

lazfreetypetest.exe fonts\arial.ttf fonts\timesi.ttf fonts\verdana.ttf

of course I created the directory fonts and put there the ttf files.

If you don't run it this way, it tries to get the fonts from some kind of  
font manager but has that is not initialized and it fails, at least that  
is what I remember.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] FLC-PDF and LazReport

2016-04-08 Thread Jesus Reyes A.
En Fri, 08 Apr 2016 15:10:47 -0500, Michael W. Vogel   
escribió:



Hi,

In a project I use LazReport and TlrCairoExport, cause I need  
implemented fonts and unicode support.


Is there a plan to do it or anybody working on a wrapper for the new FPC  
PDF generator or is it even somehow possible today?


Thank you

Michl



It's planned, I was testing fpPdf (or how will it be named?) with that in  
mind. But if somebody is in a hurry and wants to jump in, please say so.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Jesus Reyes A.
En Wed, 06 Apr 2016 13:14:49 -0500, Michael Van Canneyt  
 escribió:





On Wed, 6 Apr 2016, silvioprog wrote:

On Wed, Apr 6, 2016 at 2:14 PM, Michael Van Canneyt  


wrote:
[...]


Why is this patch needed ? It should not be needed at all ?



Sorry, I sent a wrong patch, please consider this new one in attachment.

My patch just fix wrong chars in the generated PDF, eg, before the apply
it, I got:


I see. I don't understand why this patch fixes it for you.

Because it means that somewhere a conversion happens that should not  
happen.




Here it fixes the problem too. So I did a small investigation and this is  
what I found:


The problem starts with this code:

procedure TPDFPage.AddTextToLookupLists(AText: UTF8String);
var
  str: UnicodeString;
begin
  if AText = '' then
Exit;
  str := UTF8ToUTF16(AText);
  Document.Fonts[FFontIndex].AddTextToMappingList(str);
end;

AText (a CP_UTF8 tagged string) is passed away to UTF8ToUTF16(AText) which  
expects a mere and mundane ansistring (to be used later as a pchar), the  
assembler window shows at what point the conversion is attempted:


C:\ThePathTo\fpctrunk\packages\fcl-pdf\src\fppdf.pp:1583  str :=  
UTF8ToUTF16(AText);

00435974 8b45fc   mov-0x4(%ebp),%eax
00435977 8d4dc8   lea-0x38(%ebp),%ecx
0043597A 66ba mov$0x0,%dx
0043597E e80d3dfdff   call   0x409690 
00435983 8b45c8   mov-0x38(%ebp),%eax
00435986 8d55f4   lea-0xc(%ebp),%edx
00435989 e8a286   call   0x43e030 

fpc_ansistr_to_ansistr converts AText from the given UTF8String to  
ansistring via RawbyteString. And it converts it to whatever  
DefaultSystemCodePage says it should. Now this is a problem because in  
Windows and according to the wiki this value is "The result of the GetACP  
OS call, which returns the Windows ANSI code page". In my case, and I  
guess Silvio's too, DefaultSystemCodePage=1252 not CP_UTF8, so in our case  
if AText is 'Greek: Γειά σου κόσμος' there will be problems converting  
that to CodePage=1252 which is solved by showing the "?" in the  
problematic characters


the SetMultiByteConversionCodePage(CP_UTF8) call makes  
DefaultSystemCodePage=CP_UTF8 which matches UTF8String and so in  
fpc_ansistr_to_ansistr no conversion is performed.


And so that is why SetMultiByteConversionCodePage(CP_UTF8) is needed when  
compiling in windows

:)

Jesus Reyes A.



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] PDF generator, try 2

2016-04-06 Thread Jesus Reyes A.
On Wed, 06 Apr 2016 12:23:12 -0500, Graeme Geldenhuys  
 wrote:



On 2016-04-01 20:16, Jesus Reyes A. wrote:
(it seems currently is not necessary because the matrix is  
auto-adjusted)

and then ...

   P.WriteUTF8Text(15, 120, 'Languages: English: Hello, World!');
   P.WriteUTF8Text(40, 130, 'Greek: %1B-FÃåéÜ óïõ êüóìïò');
   P.WriteUTF8Text(40, 140, 'Polish: Witaj %1B-B¶wiecie');
   P.WriteUTF8Text(40, 150, 'Portuguese: Ol%1B-Aá mundo');

Of course, before DoUnitConversion(p1); there should be a
DoMatrixTransform(p1); etc.



This change has been made and will be available in FPC repo shortly.
Incidently, this drastically reduces the amount of application code and
makes it much neater. Something I like. :)


Regards,
  - Graeme -



;)

Thanks.

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] PDF generator, try 2

2016-04-01 Thread Jesus Reyes A.
On Thu, 31 Mar 2016 18:16:18 -0600, Graeme Geldenhuys  
 wrote:


BTW, out of curiosity, in the sample there is code like this:

  lPt1 := P.Matrix.Transform(15, 120);
  P.WriteUTF8Text(lPt1.X, lPt1.Y, 'Languages: English: Hello, World!');

  lPt1 := P.Matrix.Transform(40, 130);
  P.WriteUTF8Text(lPt1.X, lPt1.Y, 'Greek: -FÃåéÜ óïõ êüóìïò');

  lPt1 := P.Matrix.Transform(40, 140);
  P.WriteUTF8Text(lPt1.X, lPt1.Y, 'Polish: Witaj -B¶wiecie');

  lPt1 := P.Matrix.Transform(40, 150);
  P.WriteUTF8Text(lPt1.X, lPt1.Y, 'Portuguese: Ol-Aá mundo');

and then WriteUTF8Text and practically every other drawing function does  
something like this:


  p1.X := X;
  p1.Y := Y;
  DoUnitConversion(p1);

The question is why isn't the transformation matrix "active"?,

I mean the code above would be simply:

  p.SetTransformationMatrix(paramst o adjust the matrix) // or 
  p.Matrix.SetTransformationMatrix(params to adjust the matrix);

(it seems currently is not necessary because the matrix is auto-adjusted)  
and then ...


  P.WriteUTF8Text(15, 120, 'Languages: English: Hello, World!');
  P.WriteUTF8Text(40, 130, 'Greek: -FÃåéÜ óïõ êüóìïò');
  P.WriteUTF8Text(40, 140, 'Polish: Witaj -B¶wiecie');
  P.WriteUTF8Text(40, 150, 'Portuguese: Ol-Aá mundo');

Of course, before DoUnitConversion(p1); there should be a  
DoMatrixTransform(p1); etc.


One thought is that coordinates could be reused and in such case it might  
help but it doesn't seem to be a very strong reason, is interesting to  
know the real reason.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Jesus Reyes A.
En Thu, 31 Mar 2016 18:16:18 -0600, Graeme Geldenhuys  
 escribió:



On 2016-03-31 22:18, Jesus Reyes A. wrote:
TPDFPage has some basic primitives for drawing: lines, rects, ellipses  
and

images. I don't see a way to add our own (except by patches to fpPDF of
course)



  // Add your custom page as follows
  P := TMyPDFPage.Create(Doc);
  Doc.Pages.Add(P); // global Page Object list
  lSection.AddPage(P); // which Section our page belongs too



Yes that would suffice, thanks.

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] PDF generator, try 2

2016-03-31 Thread Jesus Reyes A.
On Thu, 31 Mar 2016 14:58:07 -0600, Michael Van Canneyt  
 wrote:




Synopse pdf is the reason I started fppdf. Synopse is heavily Windows
centric, but otherwise quite capable.

Fppdf is a young library (although it required many months of work)
I am sure many improvements will be made as the reporting library  
develops.


A canvas descendant that renders to pdf is planned, but not very high
priority.

Patches and suggestions are definitely welcome. The library is intended  
for

production, so quality is important.

Michael.



TPDFPage has some basic primitives for drawing: lines, rects, ellipses and  
images. I don't see a way to add our own (except by patches to fpPDF of  
course) but it would be nice to have some mechanism for extension, for  
example if a TPdfPageClass=class of TPdfClass is defined, then there could  
be a TPdfPages.AddPage overloaded with an extra argument  
PageClass:TPdfPageClass, and this could be used for implementing  
additional primitives? what you hink?


Regards.

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Merge request

2016-03-31 Thread Jesus Reyes A.
On Thu, 31 Mar 2016 11:45:48 -0600, Ondrej Pokorny   
wrote:



On 31.03.2016 12:59, Gabor Boros wrote:
Please merge 52063, 52029, 51980, 51918, 51914 revisions (grid fixes)  
from trunk to fixes_1_6.


Please add them into http://wiki.freepascal.org/Lazarus_1.6_fixes_branch  
section Merge requests/Submitted by others.


Ondrej


I marked some reports with a LazTarget 1.6.2 those should be merged to  
1.6.2 as their fixes have high probability to be harmless or they fix  
regressions, the ones marked with LazTarget 1.8 should be thoroughly  
tested in 1.7.0 before they can be merged. Well, I know this can't be  
objectively evaluated so give them a couple of weeks in the wild at least.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ann: class code creation

2016-03-08 Thread Jesus Reyes A.
On Tue, 08 Mar 2016 08:01:10 -0600, Ondrej Pokorny   
wrote:



On 08.03.2016 14:15, Michael Van Canneyt wrote:

Well. You take yourself as a reference I think.


I don't think Jesus' idea wasn't really serious :)



Partly... I was aware there is no support in Lazarus for something like  
this.



Some contra's:
1.) Lazarus IDE doesn't have an API for that. I don't think anybody has  
time/will to make it - it could be pretty/unnecessarily complex to  
support it in every IDE dialog.
2.) No Lazarus function is called this way. It doesn't make sense if  
Code Creation is the only function taking advantage of it.
3.) I don't know any desktop application that works like this (except  
the TotalCommander mouse right click).


(1) is already a reason big enough for me.


Indeed.

Jesus Reyes A

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Ann: class code creation

2016-03-07 Thread Jesus Reyes A.
En Mon, 07 Mar 2016 21:21:03 -0600, Ondrej Pokorny   
escribió:



I don't think this is possible or reasonable.

On 08.03.2016 2:39, Dmitry Boyarintsev wrote:

procedure TClass.Test(y: integer);
begin
  x private|:= y;
end;


One problem is that CodeTools need valid syntax in front of y to  
evaluate the type of y correctly (the type that x gets).



Eventually people will know the dialog well, so selecting the needed  
item in the dialog might be painful.


Then we should do some kind of fast select possibility in the dialog.  
 From my point of view, typing "x private" is more paintful than writing  
just "x" and then selecting the section with key up/down from the  
dialog. If you add only private variables, you can make it the default  
choice (in Options->Code tools->Code creation) and then the dialog  
doesn't pop-up.


Ondrej


Some crazy idea:

Detect the shortcut being pressed and then start a timer, if the user  
releases the shortcut before the timer triggers, then the user wants to  
use the previous selection (in this case the private section for example)  
and then no dialog is needed, if there is no previous selection or the  
timer triggers then show the dialog. The timer interval would need to be a  
setting so it can be adjusted by the end user. :)


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] PDF generator

2016-03-05 Thread Jesus Reyes A.
En Sat, 05 Mar 2016 11:27:24 -0600, Michael Van Canneyt  
 escribió:



Hi,

I have committed a PDF generator to FPC Subversion: fcl-pdf.

Why a new pascal PDF generator ? Mainly because the existing ones  
written in Object Pascal suffer from
several disadvantages: - Font support usually incomplete or downright  
buggy.

- Dependency on a GUI (LCL, VCL, Windows).
The latter is important because the PDFs must be generated on a headless  
(no

display) webserver.

So, the fcl-pdf package contains a PDF generating unit fppdf that does  
not depend

on any external libraries or GUI system.

The PDF generator has the following features:
- Support for basic shapes.
- Support for basic line styles.
- Dictionary support.
- Multi-page PDF.
- Image support.
- TTF Font support.
- Font embedding.
- Unicode font support.
- Stream Compression.
- Image embedding.
- Several paper types.
- Portrait/Landscape.
- Support for multiple measurement units.
- Rotation matrix system.
- PDF creator information.
- The generated PDF passes several PDF validators.

The library is based on a library that came with FPGUI, with a feature  
set

which came closest to what I desired. It was completed for the company I
work for by Graeme Geldenhuys, and is heavily unit tested.

It is not yet feature-complete, but the above should be ample for most
applications.

In the near future, I expect to commit a reporting engine which,  
likewise, does not need a GUI (but can use one) and uses the PDF  
generator as one possible backend.


Todo:
- Implement TFPCustomCanvas descendent (TPDFCanvas) that draws on a PDF.
   (should allow easy integration in LCL) - Partial embedding of  
(unicode) fonts (only used glyphs) for smaller PDFs.
- On windows (possibly mac), allow to use native font mechanisms for  
extracting info from TTF files.

- Reduce memory usage by streaming finished pages to file.

Optionally:
- PDF Forms ?
- Archive format ?
- Signatures ?

Enjoy,

I would welcome additional tests/demos, suggestions, bugreports,  
improvements or patches.


Michael.



Great, thank you!

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Project Groups error - "Invalid floating point operation"

2016-02-25 Thread Jesus Reyes A.
En Thu, 25 Feb 2016 09:28:47 -0600, Graeme Geldenhuys  
 escribió:



On 2016-02-25 15:13, Mattias Gaertner wrote:

Yes. There seems to be a bug in the IDE menu merging code. It happens
only with some combinations of installed packages.


Thanks. Reading old messages from Michael van Canneyt I tried what he
suggested, but uninstalling the DataDict packages, but that meant I get
an "Exception" error at start. So a slight change.  I then, as a test,
backed up my ~/.lazarus/ profile directory and started a completely new
one. With the last executable giving me the "Exception" message, using a
brand new profile, the IDE started up without problems.

So it seems like configuration settings could also play a roll in this
issue.

I'll step by step add my custom configuration settings back in and see
what happens.

Regards,
  - Graeme -



The combination of packages that triggers this problem is  
lazdatadict+lazprojectgroups,
the problem appears only when the most recent project groups list is empty  
(this is when the MRPG submenu is hidden). The problem is an inconsistency  
on the counts of menu items between some internal list and the physical  
"project" menu items.


The issue has already a report:  
http://bugs.freepascal.org/view.php?id=29675


For myself I fixed the problem here but it has a side effect that prevents  
me committing the patch, the main menu appears inverted: Help, Windows,  
Tools, etc... Search, Edit, Files.  :)


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] StringGrid1.LoadFromCSVFile problem

2015-10-22 Thread Jesus Reyes A.
On Thu, 22 Oct 2015 12:13:17 -0500, fecske fecske   
wrote:



I like to use the StringGrid1.LoadFromCSVFile() function.
It works but also randomly ​set to a last line of strange characters

..
In the CSV file normail view are not these characters. I checked csv  
files in hex viewer and  are not these >characters.


I did a test, I wrote a Delphi code in a delphi IDE with unique function  
and stringgrid, and  are not these >characters.too.

I use the same csv files.

What's wrong in the LoadFromCSVFile() function?

Please help me?


What Lazarus version/revision do you use?. Please attach a sample csv file.

Jesus Reyes A.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] laz report crash IDE on startup with builded Option -dDisableWrapperFunctions

2015-09-20 Thread Jesus Reyes A.
En Sun, 20 Sep 2015 10:43:30 -0500, FreeMan   
escribió:



Hi Jesus,
I get this error, not while make or building lazarus in terminal. In  
terminal, download svn lazarus, then make, then run lazbuild, every  
think is normal, when I try run IDE, then crash. I sended bash script, I  
run this script then rebuild lazarus from terminal, now working normal.  
I'm not test other os.

Thank you



I always had the .sh file, I probably added it locally and forgot to  
commit it. It's done in r49855.


Anyway there seems to be a compiler error under OSX that sometimes it  
fails to link in the .res files, it sometimes happen here when I modify  
LazReport (when I forgot to clean it first) and recompile Lazarus. I was  
not able to reproduce it in a simpler project so I have not reported it.


Jesus Reyes A.




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] LazReport bug?

2015-09-07 Thread Jesus Reyes A.
En Mon, 07 Sep 2015 14:25:52 -0500, Craig Goodyear   
escribió:


I have recently upgraded from Lazarus 1.2 to Lazarus 1.4.2. Compiling a  
program with version 1.4.2 breaks a report written with version 1.2. One  
of field names in the sql statement that LazReport uses is name.


With the new version, the name of the object placed on the report is  
shown instead of the value of the name field from the sql statement.


Has the new version of LazReport reserved the word name to refer to the  
name of report objects, or is this a bug in LazReport?




Yes. At some point, the published properties of objects started to become  
available in scripts. It appears that 1.2 version already included that  
functionality, probably there were some bugs that prevented resolving the  
'name' property properly in 1.2 but was fixed later in the 1.4 version.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Printing BitMap on OSX crashes

2015-07-31 Thread Jesus Reyes A.
En Fri, 31 Jul 2015 21:09:51 -0500, Martin Grajcar   
escribió:



Hi Jesus,



On Wed, Jul 1, 2015 at 10:52 PM, Jesus Reyes A.   
wrote:
On Tue, 30 Jun 2015 05:55:43 -0500, Martin Grajcar  
 wrote:



Hello,

apologies for reposting, but I can't see in the archives (and have  
received no answer).


Are attachments forbidden here? I'm given you a link instead:
https://dl.dropboxusercontent.com/u/4971686/bitmap-crash.demo.zip

Regards, Martin.

On Thu, Jun 25, 2015 at 10:57 AM, Martin Grajcar  
 wrote:
My trivial Lazarus 1.4 application (and also our real application)  
crash whenever it prints a TBitMap on MAC. It happens in  
_platform_memmove$VARIANT>>>>$sse4 it tries to execute MOVDQA

and I thought it was an alignment problem, but it isn't.

I'm attaching my rather confusing demo. It does nothing but printing  
and seems to work fine on Linux, but crashes on OSX. Commenting out  
the StretchDraw >>>>prevents the crash. I have currently no access to  
the MAC, so I apologize for not including a minimal example.




I can reproduce it, and although the AV is easily fixed it seems  
printing bitmaps under Mac OS X it currently broken (loading a bitmap  
from a file doesn't produce AV >>but it not working anyway). I'm sure  
it used to work because I have PDF file generated using TPrinter and  
CUPS-PDF at some point.


I haven't a chance to try it yet. Just in case it's non exactly trivial,  
how can the AV be fixed? I was only accessing the MAC over a bad  
connection, which made pretty >everything complicated.


I'm also sure it used to work.


Please submit a report so it wont be forgotten.


http://mantis.freepascal.org/view.php?id=28455
Regards, Martin.




The problem occurs because the bitmap is being freed before  
Printer.EndDoc. It is at this point that the bitmap data is used, but  
because it was already freed an AV occurs. I have actually fixed the  
problem, but in my current implementation resources are only be freed at  
program end. Which is not good if somebody are printing a lot. So I have  
not committed the fix, I have another plan and will try again soon.


In the mean time, the workaround it's easy (this is not the fix I  
mentioned before which would patch the LCL+Printer support). Just create  
the bitmap before Print.BeginDoc and free it after Print.EndDoc. That  
should work.


Jesus Reyes A.

--
Usando el cliente de correo de Opera: http://www.opera.com/mail/--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lazreport: how to use global report variables

2015-07-01 Thread Jesus Reyes A.
En Wed, 01 Jul 2015 17:52:57 -0500, Graeme Geldenhuys  
 escribió:




On 2015-07-01 21:47, Jesus Reyes A. wrote:


Those are not global variables. They are report variables.


In the context of a report, they are the same thing to me. You define a
variable via the Report GUI Designer (I still don't know how to do it
from code), that variable is then available for use anywhere in your
report. ie: gloabal ;-)


:)
Yes, you can consider them as global if you so desire. However they exists  
only in your report, where they were defined. The frVariables list however  
can be used by n-number of reports in your application. This is why I  
think of them as "global"






I think the easier way to modify global variables is through the
frVariables object
ej.

frVariables['HideKlas'] := 1;


I'll take a look at that, thanks.


It seems possible to have report and global variables named the same,  
however I have not investigated who takes precedence, I would guess report  
variables are found first, but I'm not sure TBH.






But in LazReport this TStrings list functionality is not used.


Huh? You lot me there. So if they are not used, why do those properties
still exist in TfrReport?


They are not specific to LazReport, this is basic functionality of every  
TStringList, just because they descend from TStrings. Values and Names are  
public properties of TStrings, how can one hide those properties in a  
instance of TStringList?, you can't, so LazReport also can't. :D





I was not able to find a Report.Scripts property or field, maybe you  
mean

Report.Script?


Sorry, it was a typo. I meant Report.Script.

As far as I understand, LazReport is based on some open source version
of FastReport. Due to the lack of documentation (or updated
documentation) of LazReport, I looked at the documentation for
FastReport and tried to use some if what it suggests. But it seems much
of it doesn't translate to LazReport.


Yes, probably, however one could find that they have also many things on  
common.




Here is the URL of FastReport I looked at.

https://www.fast-report.com/documentation/ProgMan/index.html?adding_a_variable.htm

I worked through the whole "Working with a list of variables" section.



frxReport1.Variables['My Variable 1'] := 10; and likewise
Variable := frxReport1.Variables.Add and
Variable := frxReport1.Variables.Insert(1);

Wouldn't work on LazReport as here frxReport1.Variables is just a mere  
mortal TStringList which already have a default property: Strings[]  
indexed by integer, This part is in LazReport a little mess :), I think  
FastReport guys noted this and they fixed the situation in FastReport.




Regards,
  - Graeme -




--
Usando el cliente de correo de Opera: http://www.opera.com/mail/

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Where to find latest documentation on LazReport

2015-07-01 Thread Jesus Reyes A.
En Tue, 30 Jun 2015 07:51:05 -0500, Graeme Geldenhuys  
 escribió:



Hi,

I've found the fr_eng.pdf included with Lazarus, but it is dated 1999
(in the pdf text). I'm hoping LazReport has improved since then ,
and newer documentation is available somewhere.

Any links would be much appreciated.  Or is that fr_eng.pdf really the
latest documentation?

Regards,
  - Graeme -



It is.

Some information is being added to the wiki:

http://wiki.lazarus.freepascal.org/LazReport_Documentation
http://wiki.lazarus.freepascal.org/LazReport_Tutorial

It's an slow moving attempt :(

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Printing BitMap on OSX crashes

2015-07-01 Thread Jesus Reyes A.
On Tue, 30 Jun 2015 05:55:43 -0500, Martin Grajcar   
wrote:



Hello,

apologies for reposting, but I can't see in the archives (and have  
received no answer).


Are attachments forbidden here? I'm given you a link instead:
https://dl.dropboxusercontent.com/u/4971686/bitmap-crash.demo.zip

Regards, Martin.

On Thu, Jun 25, 2015 at 10:57 AM, Martin Grajcar   
wrote:
My trivial Lazarus 1.4 application (and also our real application)  
crash whenever it prints a TBitMap on MAC. It >>happens in  
_platform_memmove$VARIANT$sse4 it tries to execute MOVDQA

and I thought it was an alignment problem, but it isn't.

I'm attaching my rather confusing demo. It does nothing but printing  
and seems to work fine on Linux, but crashes >>on OSX. Commenting out  
the StretchDraw prevents the crash. I have currently no access to the  
MAC, so I apologize >>for not including a minimal example.





I can reproduce it, and although the AV is easily fixed it seems printing  
bitmaps under Mac OS X it currently broken (loading a bitmap from a file  
doesn't produce AV but it not working anyway). I'm sure it used to work  
because I have PDF file generated using TPrinter and CUPS-PDF at some  
point.


Please submit a report so it wont be forgotten.

Jesus Reyes A.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] lazreport: how to use global report variables

2015-07-01 Thread Jesus Reyes A.
On Tue, 30 Jun 2015 10:35:54 -0500, Graeme Geldenhuys  
 wrote:



On 2015-06-30 14:03, Graeme Geldenhuys wrote:
I've used File -> Variable List to define a new variable (just the  
name).



Digging deeper into the LazReport code, I finally found the solution.

Even though you setup a variable, you must not refer to it via the
Scripts.Values[] or Variables.Values[] properties. Go figure!

Instead you use the Values.FindVariables() method.

  FRPrint.Values.FindVariable('HideKlas').Field := '1';



Those are not global variables. They are report variables.

I think the easier way to modify global variables is through the  
frVariables object

ej.

frVariables['HideKlas'] := 1;




For more details of what I've done, see the Lazarus Forum post.
  http://forum.lazarus.freepascal.org/index.php/topic,28922.0.html


Now this begs the question... What the hell does Scripts.Values[] and
Variables.Values[] actually do?


They do the same thing they do for any TStrings list, ie. Assign values to  
supposedly existing "names" , for they to work you have to have a list  
like:


name1=value1
name2=value2
etc.

But in LazReport this TStrings list functionality is not used.

Report.Variables holds the list of variables and variables categories that  
you have defined in the Report (usually using the report designer gui).  
Variables categories can only be used as distinctive tags for a group of  
variables, and I guess that is the reason why there are a Values object  
too, which btw has a list of only variables.


I was not able to find a Report.Scripts property or field, maybe you mean  
Report.Script? in that case supposedly it holds the script to be run as  
"BeforePrint" script.


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] PowerPDF PDF level

2015-06-23 Thread Jesus Reyes A.
On Tue, 23 Jun 2015 04:57:44 -0500, Marc Santhoff   
wrote:



Hi,

can someone please tell me what version of PDF documents PowerPDF
supports?

The docs in question are mostly 1.4, some rare 1.5, but who knows.

TIA,
Marc



PowerPDF writes 1.2 version documents.

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Dropdown in stringgrid ?

2015-06-08 Thread Jesus Reyes A.
En Mon, 08 Jun 2015 06:03:28 -0500, Koenraad Lelong  
 escribió:

So you want the picklist only in the first row. Then use something like:

// use grid's OnSelectEditor
procedure TForm1.StringGrid1SelectEditor(Sender: TObject; aCol, aRow:
Integer;
   var Editor: TWinControl);
begin
   if aRow=StringGrid1.fixedRows then begin
 Editor := StringGrid1.EditorByStyle(cbsPickList);
 // fill the picklist with field list
 TPickListCellEditor(Editor).Items.CommaText :=
'Field1,Field2,Field3,etc';
 // or TPickListCellEditor(Editor).Items.Assign(FieldList)
 // or etc
   end else
 Editor := nil; // readonly the rest of rows (or select another  
editor)

end;

Hi,

It's almost what I want. Your code makes the second row behave like a  
picklist (1 fixed row : row #0 is fixed), so I subtracted 1 from  
StringGrid1.fixedRows but no luck ;-)I tried a few things, but I can't  
let the cells of the fixed row to behave like a picklist. Am I still  
missing something ?


Anyway, thanks very much already.



Can't you set FixedRows:=0?, if you do that what problems do you see in  
your program?


Jesus Reyes A.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Dropdown in stringgrid ?

2015-06-05 Thread Jesus Reyes A.
En Fri, 05 Jun 2015 05:55:51 -0500, Koenraad Lelong  
 escribió:



Op 03-06-15 om 01:19 schreef Jesus Reyes A.:


In the grid such combobox is called a picklist.

1. Select the grid
2. In the Object Inspector select the columns property and click the
"..." button.
3. Add some custom columns
4. Select the column where you wish to add a pick list
5. In the Object Inspector change the ButtonStyle to cbsPickList
6. In the Object Inspector select the PickList property and click the
"..." button.
7. Add all options you want to this list.
8. make sure the grid is editable.


Thanks, just tried this, but it's not what I need.

Like I said, I want to import a csv-file. Then, using the first row, I  
use a picklist of fieldnames to identify which column of the csv needs  
to go to which field in the database.

Maybe this clarifies it better :
---
| Field2 | Field1 || Field3 |||  <---  
picklist (Field1, Field2, Field3, blank)

---
|Col0Row1|Col1Row1|Col2Row1|Col3Row1|Col4Row1|Col5Row1|
|Col0Row2|Col1Row2|Col2Row2|Col3Row2|Col4Row2|Col5Row2|
etc.

This means column0 should got to Field2 of the database, column1 should  
got to Field1 of the database and column3 should got to Field3 of the  
database. The rest of the columns are not needed in the database.


Koenraad.



So you want the picklist only in the first row. Then use something like:

// use grid's OnSelectEditor
procedure TForm1.StringGrid1SelectEditor(Sender: TObject; aCol, aRow:  
Integer;

  var Editor: TWinControl);
begin
  if aRow=StringGrid1.fixedRows then begin
Editor := StringGrid1.EditorByStyle(cbsPickList);
// fill the picklist with field list
TPickListCellEditor(Editor).Items.CommaText :=  
'Field1,Field2,Field3,etc';

// or TPickListCellEditor(Editor).Items.Assign(FieldList)
// or etc
  end else
Editor := nil; // readonly the rest of rows (or select another editor)
end;

// use grid's OnPickListSelect
procedure TForm1.StringGrid1PickListSelect(Sender: TObject);
begin
  // make something with picklist itemindex, the current grid column is  
given by StringGrid1.Col

end;

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Dropdown in stringgrid ?

2015-06-02 Thread Jesus Reyes A.
En Tue, 02 Jun 2015 06:01:05 -0500, Koenraad Lelong  
 escribió:



Hi,

I'm trying to make a "universal importer".
I have a database I want to populate/modify with data from a csv-file.  
The column order of the csv-file cannot be imposed. So I have to have a  
way to say which column of the csv-file is which field in the database.


I have a commercial application that has something like a stringgrid but  
the first row has dropdown's with possible field-names. I was trying to  
mimic this, more or less, but had issues.


Is this possible someway ? Any hints ?

Koenraad



In the grid such combobox is called a picklist.

1. Select the grid
2. In the Object Inspector select the columns property and click the "..."  
button.

3. Add some custom columns
4. Select the column where you wish to add a pick list
5. In the Object Inspector change the ButtonStyle to cbsPickList
6. In the Object Inspector select the PickList property and click the  
"..." button.

7. Add all options you want to this list.
8. make sure the grid is editable.

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] LazReport Questions

2015-05-27 Thread Jesus Reyes A.

En Mon, 25 May 2015 21:39:41 -0500, steveg  escribió:


Thank you Michael.

I have then following problems currently -

1:
I am placing a subreport in a Group footer (to run a charges query for  
each client in group break)
It would appear that the subreport is run 'after' accessing all other  
fields in the footer, no matter what it is named, or where it is  
placed.  I would like to be able to specify when it runs in relation to  
the other fields (to be able to use it for further calculations).

Is this at all possible ?


Is not possible in current implementation. Name or Position (x,y) have no
effect, however "z-order" (relative position between objects) might help.
It even seems that as soon a subreport is found any remaining object is  
skipped.




2:
All objects seem to be accessed in the order they are saved in the lrf  
file, not by Name (alpha) or position - this makes it problematic when  
using them for calculations.
Is it possible to have the running report fill in the fields by alpha  
name position instead ?


Not in the current implementation.



3:
Deleting an object from a report (memo / band / subreport) will often  
cause the program to abort.
I haven't yet been able to conclude precisely what its related to, but  
still watching.

Does anybody else have this issue ?



I haven't seen it. Feel free to submit a bug report with a sample project.

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TStringGrid.OnSelectEditor

2015-05-14 Thread Jesus Reyes A.
En Wed, 13 May 2015 19:48:56 -0500, Vojtěch Čihák   
escribió:




Hi,


I got troubles with TStringGrid. When I set:


goAlwaysShowEditor:=False;

goEditing:=True;


OnSelectEditor is triggered always when I select any cell, even if  
editor (built-in or custom) is not shown yet.


When I click the cell for the second time, editor is shown and  
OnSelectEditor is triggered again.



I guess it's a bug, after all there are other events for selecting cell  
(OnSelection, OnSelectCell).



Is it by design or should I report?


Thanks, V.


P.S.:

When options are:

goAlwaysShowEditor:=True;

goEditing:=True;


OR


goAlwaysShowEditor:=False;

goEditing:=False;


OnSelectEditor works as expected.


I think is not a bug (at least that kind of bug that is against the  
documentation).
But I see no reason why it should work the way it does now, please check  
r49016


Jesus Reyes A.--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Processing TCoolBar child by IDE

2015-05-11 Thread Jesus Reyes A.

En Mon, 11 May 2015 16:25:50 -0500, Juha Manninen
 escribió:


On Tue, May 12, 2015 at 12:21 AM, Jesus Reyes  wrote:

TBH, I don't know if they are "completly" broken,


One more thought: There is an installation package for Mac OSX, built
by Mattias. He was able to compile generics on Mac.
Can it depend on compiler options?

Juha




I tried with the released version and it works
So it must be some flag that makes the difference.

The question now is if one should trust 2.6.4 when compiling generics code.
IMO It is still confusing ... to use or not use...

At least the weird situation of how was possible to have a release with
this
compiler and the current code in Lazarus is solved.

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Processing TCoolBar child by IDE

2015-05-11 Thread Jesus Reyes A.
En Mon, 11 May 2015 16:25:50 -0500, Juha Manninen  
 escribió:



On Tue, May 12, 2015 at 12:21 AM, Jesus Reyes  wrote:

TBH, I don't know if they are "completly" broken,


One more thought: There is an installation package for Mac OSX, built
by Mattias. He was able to compile generics on Mac.
Can it depend on compiler options?

Juha



I tried with the released FPC version 2.6.4 and it works :P
So it must be some flag that makes the difference.

The question now is if one should trust 2.6.4 when compiling generics code.
IMO It is still confusing ... to use or not use...

At least the weird situation of how was possible to have a release with  
this

compiler and the current code in Lazarus is solved.

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Strange behavior of AutoSizeColumn in StringGrid

2015-05-06 Thread Jesus Reyes A.
On Wed, 06 May 2015 04:15:43 -0500, Valdas Jankūnas   
wrote:



2015.05.06 01:52, Jesus Reyes rašė:

If that is the intended behaviour (Multiline title property is a  
contribution, Werner?)
then it's OK to me, in that case please try the attached patch and  
write back your results,

here I tested under Windows and it seems to work fine.



tested on Linux: AutosizeColumn[s] stops working. But if I add line  
"aRect := Rect(0, 0, High(integer), High(integer));" before  
"DrawText..." then it works, also bug is gone.




I'm sorry for my previous two messages. I hope this time it will go ok.
the following is what I replied in both cases.
- - - - - - - - - -

Weird, now I have tested in both Linux and Mac and it works fine
without your change..

Anybody else?

Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] DB aware components

2013-09-17 Thread Jesus Reyes A.
En Mon, 16 Sep 2013 04:12:31 -0500, Mattias Gaertner  
 escribió:




Maybe a result of Juha's change:
http://wiki.freepascal.org/Lazarus_1.2.0_release_notes#TComponentPropertyEditor_behavior_was_changed

Mattias


Strange, is this the way it works in Delphi? Why not invent something  
specifically for ActiveControl instead?


Jesus Reyes A.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus