[lazarus] Forcing fonts

2005-08-22 Thread A.J. Venter
Hi all,
Okay, the WIKI states that font setting is very limited (unless you use canvas 
drawn components) since GTK overrrides your settings.

Is there ANY way I can get around this ? I am getting desperately annoyed that 
after I create a really good looking program, the first time a user changes 
his desktop theme, the captions no longer fit on the buttons :(
All my apps now use GTK2.

I have tried to hack gtkrc-2.0 by hand - no luck there, it seems to ignore the 
font line entirely. 

Resizing the buttons is not an option, I HAVE to support 640x480 resolution 
and the buttons only just manage to all fit on screen as it is.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Forcing fonts

2005-08-22 Thread A.J. Venter


  I would say a more sane approach is that application settings should
  override  theme defaults. I know the gnome guys have this thing about
  deciding how  every human being on the planet ought to think but surely
  they didn't make it  impossible to do this ? Did they ?

 The gnome guys think, that fonts and themes should be controlled by the
 user, i.e. every human being on the planet, not by the application, i.e.
 programmer.

Oh I've heard their arguments, I even agree with them. It's their METHODS I 
don't approve off.
I think they go about their goal of consistency in completely the wrong way 
and fail exactly at what they set out to do - controll by the user. Where KDE 
gets it right is letting the user configure everything, then sticking with it 
as DEFAULT which the user can overwrite PER APPLICATION because not all apps 
do the same tasks and thinking that there can be a completely universal 
good standard is just stupid. Some apps NEED to look different in order to 
actually work usably. I have actually had a lead gnome dev (who shall remain 
nameless) say: any setting that would only be usefull to one application 
must never be implementable. This I dissagree with 100%. 
As far as I am concerned, too many options for configuration is a lesser crime 
than too few, and every real user agrees with me - and I have a rather 
particular point of authority in this. I have thousands of users, and 95% of 
them were first time computer users when they touched my system for the first 
time. They all had the option of gnome or KDE, and they all tried both, and 
they all preffered KDE - because KDE could look the way they wanted it to. In 
the end TRUE userfriendlyness is recognizing that every user is unique, and 
allowing every bit of the system to be adaptable to the USER's preffered way 
of working - when you have that the computer learns the user and no longer 
vice versa. 
In fact, before I began on OpenLab 4 I did a survey among my paying customers, 
since not a single user was using the gnome desktop by choice. I won't be 
including it in OpenLab4 - I see no point of supporting something my 
customers don't want anyway. The gnome libs are there, cos there are some 
cool gnome apps. But that's it.

A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Forcing fonts

2005-08-22 Thread A.J. Venter
  For starters I created in
  olpack(http://silentcoder.co.za/viewsvn/viewsvn.php?project=lazaruspath=
 %2Folpack%2F) the screensize component, these particular apps, by their
  very nature are used alone, so they run maximized. Since lazarus doesn't
  (yet?) obey ws_maximized, I use the screensize to get the

 Tell me how the code to set ws_maximized looks, and I can check if the
 gtk backend of lazarus handles it, and fix it. Is it just via
 windowstate ?

That's all I've tried, windowstate in the object inspector. Bear in mind I've 
never actually USED delphi. I first learned a bit GUI programming in Java 
around 5 years ago before then I had spent about 10 years doing nothing more 
GUI than ncurses :p
I got sick of java FAST ! 

So I actually wrote the freepascal support for tcl/tk and maintained it for 
some time (nobody else seemed very interested though) so I stopped bothering, 
haven't actually even looked at that code for about 3 years. Anyway, at that 
point I had no use for doing any GUI programming in my career that couldn't 
be handled by the odd bit of SDL.

Things changed and suddenly the same job was involving a LOT of GUI coding, so 
I studied the principles of it. When it came to actually using a language 
though, I opted for the one I knew best (pascal based, been using it since I 
was 9 years old after all) and chose Lazarus. Been doing that ever since.

Effectively though, what I know about how to actually CODE GUI's I learned 
from using a delphi book and playing with lazarus by myself. Oh and 
constantly reading this mailing list !

A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] forcing a component to repaint itself

2005-08-23 Thread A.J. Venter
Okay, 
I have a small problem with my tfunkymemo component, it doesn't repaint after 
loading a new file into it. This is a bit of an issue if you look at what I 
use it for (what I CREATED it for) which is live help in the app that changes 
as you navigate. The help files load perfectly, but because it's canvas drawn 
it doesn't show until the form is repainted. moreover since it's on a 
sepperate panel to where the actual navigation occurs, it doesn't seem to get 
repainted by events in the app. If you minimize and then maximize the screen 
it does update though. 
I tried calling form1.paint and form1.panel1.paint after the loadFromFile, 
neither had any effect (not to mention this should really be handled in 
module code) - how can I force the component to repaint itself after 
loadFromFile is called ?

I honestly don't know which bit of the component source is relevant to snip, 
so I'll just link to all of it (asuming that it may be needed):
http://silentcoder.co.za/viewsvn/viewsvn.php?project=lazaruspath=%2Folpack%2Ffunkymemo.pas

TIA for any advice.
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Bugs ? Startlazarus increases link times

2005-08-30 Thread A.J. Venter
Right, I can't be certain the drive is fine of course, but it is brand new - 
I've have this laptop less than a month. It isn't a great work horse but it's 
all I got until my desktop CPU comes back from repairs.

That said, dmesg and messages are both empty,  and it does finish, machine has 
180mb of ram. 

A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Bugs ? Startlazarus increases link times

2005-08-30 Thread A.J. Venter
Ok some stats from my setup then:
Lazarus version: Subversion checkout on saturday (same happened with 0.9.8 
however)

CPU: AMD Sempron 2800+
CPU Mhz: 1600
Acer Aspire 3000

ld version - from binutils 2.15.92.0.2

*cast confusion. on .

A.J.
On Tuesday 30 August 2005 20:01, L505 wrote:
 Tested linking times (not including compiling time)

 Lazarus:
 -
lazarus.new.exe
2 minutes : 37 seconds


 StartLazarus
 -
   lazarus.new.exe
   2 minutes : 54 seconds

 Celeron 400mhz, 327MB RAM, Windows 2000
 Lazarus Version: 0.9.7 RB Alpha
 LD.exe version: not sure, it is 279,552B in size

-- 
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Menu icons in KDE / Gnome

2005-09-06 Thread A.J. Venter


 That's highly distribution-specific. There are some efforts to make a
 standard, though.

 For Fedora: install the desktop-file-utils. Make a desktop-file (see an
 example in lazarus/install/gnome.ide.desktop) and then run desktop-file-
 install desktopfile.desktop. (this also makes a kde-icon and menu-entry)

Aahh, a question the distribution developer gets to answer :)
Actually, the freedesktop standard is very specific, although gnome fails to 
follow it completely unless you tweak a bunch a stuff, KDE does follow it 
perfectly so the easy way for the programmer is to install for gnome since 
KDE will pick it up.

KDE and gnome will both check /usr/share/applications/ for desktop files, so 
that's where your desktop file should go, to prevent inter-distro issues, 
install your icon picture somewhere global as well, and set a full path in 
the desktop file.
Finally, the crunch is that to get your menu item in the right place, you need 
to use categories, the reason for those are that the distro's can rename menu 
sections, but the application entries will be still be sorted like-by-like.

The easy way to do those, are to drag an item from the same part of the menu 
you want to be in onto your desktop, and look at it with a text file, the 
categories are usually the last line, just copy and paste it into the bottom 
of your own file.

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] TMemo only shows English

2005-09-07 Thread A.J. Venter
Help. 

I'm working on integrating the translations for the OpenLab installer now 
a.t.m. unfortunately they are not working.
All the files are in plain text, which is the same I had used for earlier 
versions of OpenLab, except now the installer is using GTK2,
whenever I try to load one of the translations, it just shows an empty window 
though, in the shell I get a lot of errors from Pango complaining about 
invalid UTF-8 strings.

How do I fix this please ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: Help - TMemo shows only english text

2005-09-07 Thread A.J Venter
So nobody has an answer :(

Oh well, I'll just redo them as TFunkyMemo's, that handles every language I've 
thrown at it so far. Was hoping to avoid that though, it's a lot of overtext 
for plain text.

A.J.

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: Help - TMemo shows only english text

2005-09-07 Thread A.J Venter
On Thursday 08 September 2005 00:27, Marc Weustink wrote:
 A.J Venter wrote:
  So nobody has an answer :(
 
  Oh well, I'll just redo them as TFunkyMemo's, that handles every language
  I've thrown at it so far. Was hoping to avoid that though, it's a lot of
  overtext for plain text.

 TBH, At first I had no clue of what your problem was.

 THere are only Lower ascii chars in you lang files or do they have some
 ISO encoding ?
 In the latter case, what is yout LANG setting ?

The files are plain text, but almost certainly not plain ASCII, after all they 
contain other languages, thus far French, Afrikaans and Portoguese. They show 
up perfectly in vim and also in ever graphical editor I've tried. The LANG 
setting is probably on EN-US and would be a tricky one to change as the 
language is supposed to be altered live by a selection during the 
installer. My current design is simple, each language has all the message 
files in a tarbal named after the language, I read all the file names and 
show a drop down list, the user chooses, I extract his chosen selection and 
and move on with the next dialog. The actuall installer is written in bash, 
but I use lazarus created dialogs to ask questions, show menu's etc. 
Simliar to using something like xmessage actually, but I get to make all the 
dialogs look alike and follow the OpenLab GUI designs.
I'm open to suggestion here, though I'm getting close to my deadlines :( - 
trouble is I couldn't even ASK for translations until all the messages were 
finalized (for obvious reasons) so their the last thing to happen, and I 
wasn't expecting difficulties.

Is there some way I can tell a TMemo to handle UTF-16 instead ? Possibly with 
a fileheader ? I'm pretty sure there's nothing in there that can't be 
displayed by UTF-16, it's not like I've had any translations to asian 
languages.

A.J.



_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] TListBox - Multiselect

2005-09-12 Thread A.J. Venter
Hi all,
A Quick question, I know how to find out which item in a TListBox was select 
with single selection. Now however, I wish to do a multi-selecting one, how 
can I determines which ITEMS were selected.

Ideally I need to be able to feed all the selected items into a loop and step 
over them one by one. Does A TlistItem have a ''selected'' property ? Would 
doing a for loop over the TListBox.Items testing for selected work ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TListBox - Multiselect

2005-09-12 Thread A.J. Venter


 A listbox also has a selected property. You can check if an item is
 selected by checking the corresponding selected instance. Like:
 begin
   for I := 0 to (ListBox1.Items.Count - 1) do begin
 if ListBox1.Selected[I] do
   ShowMessage(ListBox1.Items[I] + ' is selected');
   end;
 end;

Thanks, this is exactly what I needed, now a related question, how can I 
determine the LAST thing that was selected ? In the order the user clicked 
it, I need to hook up something to the onSelectionChange event that will let 
me show a description of the current selected item, and if another is 
selected, change to the description for the new one etc. etc.

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Re: Graphics basics on gtk

2005-10-01 Thread A.J. Venter

 The timer problem is non-graphics related. I would like to receive data
 from the ISA card at 500khz (or I will lose data). But thank you all for
 your help so far. I will research if there is a way to create a very
 efficient timer. If not, I'll just use another thread.

Felipe, you may also want to look at gamepack, which provides a 
double-buffered drawing component as well as sprite support. Mail me off-list 
if you want the details.

Ciao
A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Re: Graphics basics on gtk

2005-10-02 Thread A.J. Venter
On Sunday 02 October 2005 04:01, Felipe Monteiro de Carvalho wrote:
 A.J. Venter wrote:
  Felipe, you may also want to look at gamepack, which provides a
  double-buffered drawing component as well as sprite support. Mail me
  off-list if you want the details.

 Sounds very interesting. TDoubleBuffer seams very similar to what I am
 trying to do. I must be doing a simple error ...

 I really am going to write a good example program about this once I have
 time and get this right.

 But why don't you give the details on the list? This way they might
 benifit someone reading the mail archives...

Because I have given it on-list before and don't wish to be accused of 
spamming. Since you ask though, you can check it out from SVN with 
svn co svn://silentcoder.co.za/lazarus/gamepack

Or you can browse the code at http://www.silentcoder.co.za/viewsvn

It's under the lazarus license.

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TApplication.Terminate

2005-10-25 Thread A.J. Venter
On Tuesday 25 October 2005 17:42, Alain Michaud wrote:
 Hi,

   I had the same problem a while ago. There were some discussions on
 this list and this seems to be a deep bug.

 In my case, I noticed that any timer runing would not stop.

 Finally I found the ultimate weapon: I send the kill command to the
 shell.

 1 -find the PID of your program
 2 - send exec(kill pid);
  
 (something like that. I can give you the exact code if you want

 It works!
I've had the same bug, but I think THAT answer lacks a certain elegance as an 
interim measure, I chose to remember some of my old pascal, and my close 
handlers look like this:
{Insert code to try and cleanup as much as possible here}
application.terminate;
halt;

The halt command of course is technically a pascal command but it DOES seem to 
work. The only thing I'm not sure of is what it actually DOES under linux, 
hopefully it uses signals. I do know that it's alternative form 
[halt(status:integer);] is apparently the only way to set an exit status 
(granted that is more commonly needed for commandline than GUI apps however).

Ciao
A.J.


-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Incredibly weird canvas.TextOut bug

2005-11-08 Thread A.J. Venter
On Wednesday 09 November 2005 04:22, A.J. Venter wrote:
 Hi all, I'm totally stumped by this one, for some reason, within my one
 custom component (a TFunkyMemo) the textouts are working just fine,
 however, those on the OTHER side of the screen (which are done through
 tsprites on top of tdoublebuffer) are behaving in a seriously weird way.
 Only the one on the far left shows up. This happens in BOTH gtk1 AND gtk2
 on linux.

mmm, I realized later I was unclear here, when I say only the one on the far 
left, I do NOT mean the TFunkMemo's contents, I mean only the text printed on 
the far left SNOWMAN shows up.

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com
http://www.silentcoder.co.za

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TrayIcon preview

2006-01-17 Thread A.J. Venter
Hi Felipe,
Thank you for this, something I've been VERY much wanting in lazarus was 
trayicon support.

A few quick questions though
1) Is it a component ? Visual ? Nonvisual ? I admit I've only had a cursory 
glance at your sources, not a sufficient study yet.
2) Is there a README or a short howto available ?

And one for Mattias et all - this is SUCH a widely useable thing and since 
Felipe made it nicely multiplatform for ALL the currently active Lazarus 
platforms, shouldn't it go into Lazarus itself ?

Ciao
A.J.
On Monday 16 January 2006 23:49, Felipe Monteiro de Carvalho wrote:
 The test program works on Linux (tested on Gnome, KDE, IceWM) and
 Windows (tested on XP).
 --
 Felipe Monteiro de Carvalho

-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] platform independent application launching

2006-01-27 Thread A.J. Venter
Hi all,
I have an interesting dillema, I need to write a platform independant program 
which needs to be able to launch other programs. It must NOT wait for them to 
exit  but merely launch them, specifically we`re talking about launching 
things like a web-browser or pdf viewer.

The choice of the actual commands I will handle, the bigger problem is how to 
do it. Obviously the  method only works on unixes (I definitely need win32 
support) and as far as I know, tprocess cannnot LAUNCH a program and then 
forget about it and pass control back to my own app.

If there is no single way to do it, I am happy to use IFDEFS, but of course I 
still need to know what I can do on windows.

Any ideas ?
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] New lazarus based program

2006-01-27 Thread A.J. Venter
For those interested.
http://silentcoder.co.za/tiki/tiki-view_blog_post.php?blogId=2postId=214

Sidenote: Since the blog went out, a friend of mine has already started on a 
Mac port, gotta love multiplatform compilers !
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Access violation ?

2006-01-28 Thread A.J. Venter
Hi all,
I am trying to build a native gzip uncompressor into a unit for use by 
programs, no difficulty right, I just use paszlib and stole (with some 
adaptation) the code from the minigzip example to come up with this function 
(I chose a function in order to feed the output back to a graphical programs)

Trouble is, as soon as I try to use it, the program gets an access violation. 
In the terminal I can pick up the following output:

TApplication.HandleException Access violation
  Stack trace:
  $4048B4C0  LAZARUSPACKAGEINTF_finalize,  line 49 of gtkglobals.ppiphtml.pas
--
It doesn't actually matter WHICH packages are required, if I comment out the 
functions in the same unit that use iphtml and remove the requirements it 
still happens. If I remove the file from the package and try compiling a test 
program with the unit just in the same directory, it still fails. 
All that changes is the unit in WHICH it dies (seems to fall back to plain 
gtkglobals if iphtml is not present).

I assume the mostly plain pascal code this was based on is somehow not 
lazarus/package compatible but I am at a loss to explain why.

Any advice greatly appreciated, the function follows below

-
function gz_uncompress(inputfile,outputfile :string):Integer;
Var len:Int;
Written:Uint;
ioerr  :Integer;
err:int;
Busy   :Boolean;
Status :Integer;
infile :gzfile;
outfile:file;
Begin
infile := gzopen(inputfile,'r');
Assign(OutFile,OutputFile);
Rewrite(OutFile,1);
Status := 0;
Busy := True;
writeln('test');
  While Busy do begin

 len := gzread(infile, @buf, BUFLEN);
 if (len  0) then
   Begin
 Busy := False;
 Status :=  GzReadError;
   end;
 if len = 0 then
 Busy :=  False;

if busy then
Begin
{$I-}
 blockwrite (outfile,buf,len,written);
{$I+}
  if (written  len) then
   Begin
Busy := False;
Status := WriteError;
   end;
 end;
  end; {While}

If Status = 0 then
begin
 {$I-}
  close(OutFile);
 {$I+}
   ioerr := IOResult;
if ioerr  0 then
  Status := IOResult;

  if Status = 0 then
   if gzclose(infile)  0 then
 Status := GzCloseError;
end;
  gz_uncompress := Status;
end;

---
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Access violation ?

2006-01-28 Thread A.J. Venter
Another note on this, I stripped the function into a unit all of it's own (no 
package), then I called this  function from a lazarus program and got an 
access violation as soon as I called gz_uncompress.

I then created a very simple little plain pascal program calling the same unit 
with paramstr(1)'s - worked perfectly with no errors.

E.G. Whatever is wrong is indeed something in the pascal code clashing with 
something in the Object Pascal of lazarus - any ideas ?

A.J.
On Saturday 28 January 2006 15:01, A.J. Venter wrote:
 Hi all,
 I am trying to build a native gzip uncompressor into a unit for use by
 programs, no difficulty right, I just use paszlib and stole (with some
 adaptation) the code from the minigzip example to come up with this
 function (I chose a function in order to feed the output back to a
 graphical programs)

 Trouble is, as soon as I try to use it, the program gets an access
 violation. In the terminal I can pick up the following output:
 
 TApplication.HandleException Access violation
   Stack trace:
   $4048B4C0  LAZARUSPACKAGEINTF_finalize,  line 49 of
 gtkglobals.ppiphtml.pas --
 It doesn't actually matter WHICH packages are required, if I comment out
 the functions in the same unit that use iphtml and remove the requirements
 it still happens. If I remove the file from the package and try compiling a
 test program with the unit just in the same directory, it still fails.
 All that changes is the unit in WHICH it dies (seems to fall back to plain
 gtkglobals if iphtml is not present).

 I assume the mostly plain pascal code this was based on is somehow not
 lazarus/package compatible but I am at a loss to explain why.

 Any advice greatly appreciated, the function follows below

 -
 function gz_uncompress(inputfile,outputfile :string):Integer;
 Var len:Int;
 Written:Uint;
 ioerr  :Integer;
 err:int;
 Busy   :Boolean;
 Status :Integer;
 infile :gzfile;
 outfile:file;
 Begin
 infile := gzopen(inputfile,'r');
 Assign(OutFile,OutputFile);
 Rewrite(OutFile,1);
 Status := 0;
 Busy := True;
 writeln('test');
   While Busy do begin

  len := gzread(infile, @buf, BUFLEN);
  if (len  0) then
Begin
  Busy := False;
  Status :=  GzReadError;
end;
  if len = 0 then
  Busy :=  False;

 if busy then
 Begin
 {$I-}
  blockwrite (outfile,buf,len,written);
 {$I+}
   if (written  len) then
Begin
 Busy := False;
 Status := WriteError;
end;
  end;
   end; {While}

 If Status = 0 then
 begin
  {$I-}
   close(OutFile);
  {$I+}
ioerr := IOResult;
 if ioerr  0 then
   Status := IOResult;

   if Status = 0 then
if gzclose(infile)  0 then
  Status := GzCloseError;
 end;
   gz_uncompress := Status;
 end;

 ---

-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] PasZlib still

2006-01-29 Thread A.J. Venter
I am still unable to get paszlib to work. 

I have since gone to some pretty big lengths toward my goal, but I am afraid I 
am stuck.
I think the ideal way would be to be able to read the file into a TMemstream, 
decompress it into another Tmemstream and then write that out, but I must 
admit I have no idea how to go about achieving that.

So considering that, for the moment I decided that I may have made a mistake 
in my code conversions, so I fell back on minigz's own code virtually 
unaltered, but wrapped inside a component.

All I get is that when I call the extract method - the program throws:
TApplication.HandleException Access violation
  Stack trace:
  $40489AE0  GZ_EXTRACT_finalize_implicit,  line 54 of gtkglobals.pp

What does an error in finalize MEAN ?

I did an strace on the program, and it certainly reads and writes a LOT of 
data once you trigger the method, so SOMETHING is happening before the crash.

I attach my full source code this time, if somebody would like to see the 
trace I will mail that offlist as it is likely to be huge.

I urgently need to get this working to do transparent decompression for 
OpenBook on windows (calling gunzip only works where gunzip works well).

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103
{ Copyright (C) 2006 A.J. Venter

  This library is free software; you can redistribute it and/or modify it
  under the terms of the GNU Library General Public License as published by
  the Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  for more details.

  You should have received a copy of the GNU Library General Public License
  along with this library; if not, write to the Free Software Foundation,
  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit gz_extract;
{Note - you must add turbopoweripro to your project requirements for
this to work}
{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils,Process,zutil,gzIo, Forms, Controls, Graphics, Dialogs;
  
Type
TGZ_Extractor = class(TComponent)
private
FInputFile : String;
FOutPutFile : String;
public
destructor destroy; override;
Procedure Extract;
published
property InputFile : String write FInputFile;
property OutPutFile : String write FOutPutFile;
constructor create(AOwner: TComponent); override;
 end;

procedure register;

Implementation
{TGZ_Extractor}

const
  BUFLEN   = 16384 ;
  GZ_SUFFIX= '.gz' ;
  
{$DEFINE MAXSEF_64K}

var
  buf  : packed array [0..BUFLEN-1] of byte; { Global uses BSS instead of stack }
  prog : string;


procedure error (msg:string);
begin
showMessage(msg);
end;


procedure Register;
begin
  RegisterComponents('OLPack',[TGZ_Extractor]);
end;


procedure gz_uncompress (infile:gzFile; var outfile:file);
var
  len : int;
  written : uInt;
  ioerr   : integer;
  err : int;
begin
  while true do begin

len := gzread (infile, @buf, BUFLEN);
if (len  0)
  then error (gzerror (infile, err));
if (len = 0)
  then break;

{$I-}
blockwrite (outfile, buf, len, written);
{$I+}
if (written  len)
  then error ('write error');

  end; {WHILE}

  {$I-}
  close (outfile);
  {$I+}
  ioerr := IOResult;
  if (ioerr  0) then begin
writeln ('close error: ',ioerr);
halt(1);
  end;

  if (gzclose (infile)  0{Z_OK})
then error ('gzclose error');
end;

procedure file_uncompress (filename,outname:String);
var
  inname  : string;
  infile  : gzFile;
  outfile : file;
  ioerr   : integer;
  len : integer;
begin
  len := Length(filename);

inname := filename;

  infile := gzopen (inname, 'r');
  if (infile = NIL) then begin
writeln (prog,': can''t gzopen ',inname);
halt(1);
  end;

  Assign (outfile, outname);
  {$I-}
  Rewrite (outfile,1);
  {$I+}
  ioerr := IOResult;
  if (ioerr  0) then begin
writeln ('open error: ',ioerr);
halt(1);
  end;

  gz_uncompress (infile, outfile);

end;


Procedure TGZ_Extractor.Extract;
Begin
   File_UnCompress(FInputFile,FOutPutFile);
end;



destructor TGZ_Extractor.destroy;
Begin

end;

constructor TGZ_Extractor.create(AOwner: TComponent);
begin
  inherited create(AOwner);
end;

end.



Re: [lazarus] PasZlib still

2006-01-30 Thread A.J. Venter
Thanks for this, I am now evaluating all the suggestions.

Just a question Graeme, does dzlib deal with winzip or gzip format ? The files 
I need access to are all gzipped.

Ciao
A.J.
On Monday 30 January 2006 18:51, Graeme Geldenhuys wrote:
 Hi AJ,

 Not sure if paszlib is the same as dzlib?  I think the dzlib just uses
 the same zlib interface as what is included in Dephi.

 Anyway, I attached a zip file containing 5 units as I use them.

 tiCompress:
 Defines a abstract class and a Factory for registering different
 compression algorithms with my app.

 tiCompressZlib:
 Implements the interface with zlib compression

 tiCompressNone:
 Implements the interface with no compression. Handy for unit testing
 and debugging.

 tiConstans:
 contains some of the constans I use

 dzlib:
 zlib compression library

 Hope that helps a fellow ZA citizen.

 Regards,
   - Graeme -

 On 1/29/06, A.J. Venter [EMAIL PROTECTED] wrote:
  I am still unable to get paszlib to work.
 
  I have since gone to some pretty big lengths toward my goal, but I am
  afraid I am stuck.
  I think the ideal way would be to be able to read the file into a
  TMemstream, decompress it into another Tmemstream and then write that
  out, but I must admit I have no idea how to go about achieving that.

-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] lazarus components

2006-02-01 Thread A.J. Venter
Andrea, while I do not have a tutorial on it (though I was planning to write 
one when I have time actually) the process is very similar to Delphi, you can 
browse my SVN tree
http://www.silentcoder.co.za/viewsvn

For several component packs with a number of components, being fairly small 
components - they are easy to base others from.

A.J.
On Wednesday 01 February 2006 17:59, Andrea Mauri wrote:
 In internet I found a lot of tutorial on how to write components in delphi.
 I found also a tutorial that explain how to convert delphi component for
 lazarus.
 I would like to try to write components with lazarus, there is a wiki
 page or a tutorial to do that?
 Can I follow the tutorial dedicated to delphi also for lazarus? Which
 are the main differences?
 Thanks,
 Andrea

 _
  To unsubscribe: mail [EMAIL PROTECTED] with
 unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives

-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Window Icon again - Proposal

2006-02-01 Thread A.J. Venter


 The linux/gtk forms have icons.
 What is missing, are icons showing in the file managers. This is normally
 done by copying an image of the executable name to a directory like
 /usr/shar/pixmaps/.
Aye which will usually set the window icon anyway so normally it doesn't 
bother people - except my program is meant to run uninstalled from a DVD so 
that doesn't entirely work anymore.
But then... if the linux forms have icons... where/how do you set them ? Or is 
the ONLY way currently to install an icon to $ICONDIR. I can't find any place 
to do so under project options (latest lazarus from svn).


  The trickiest bit is likely to be reading an X11 Pixmap variable out of a
  TPixmap.

 See thread
 Application Icon under Win32 (modified patchs)
 from 9 Feb 2005
Thanks for that.
A.J.

-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Window Icon again - Proposal

2006-02-01 Thread A.J. Venter
On Wednesday 01 February 2006 19:28, A.J. Venter wrote:
  The linux/gtk forms have icons.
  What is missing, are icons showing in the file managers. This is normally
  done by copying an image of the executable name to a directory like
  /usr/shar/pixmaps/.

 Aye which will usually set the window icon anyway so normally it doesn't
 bother people - except my program is meant to run uninstalled from a DVD so
 that doesn't entirely work anymore.
 But then... if the linux forms have icons... where/how do you set them ? Or
 is the ONLY way currently to install an icon to $ICONDIR. I can't find any
 place to do so under project options (latest lazarus from svn).

Scratch that, found it in the form properties, been using lazarus too long, 
I'm too used to what isn't there...

A.J.
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Dumb question - updating a progressbar

2006-02-01 Thread A.J. Venter
On Wednesday 01 February 2006 16:40, A.J. Venter wrote:
 Hi all,
 Why is it that I cannot seem to get my progressbar to update ¨live¨

 I am trying to show the progress of decompressing files when the user
 selects a multifile book in OpenBook.

Don't worry about it, I decided to do the right thing(tm) and I used a thread.

All good now :)

A.J.
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] GetFileList

2006-02-01 Thread A.J. Venter
I have been trying all night through a thousand variations on the theme of 
findfirst and findnext to try and come up with what should be a simple 
algorythm, start at a specified toplevel directory, and add every file below 
it with full path to a stringlist.
Of course it does need to recurse subdirectories. Constantly failing, I tried 
googling but all I can find is delphi components which while they ought to be 
simple enough all throw access violations at runtime.

Any advice ? Or perhaps somebody feels bored...

TIA
A.J.

-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] GetFileList

2006-02-02 Thread A.J. Venter
',
  'The mask '+FilterAsText+' is not a valid expression.');
  end;
end;
  end;

var
  Directory: String;
begin
  Result:=false;
  RemoveFilterRegExpr:=nil;
  KeepFilterRegExpr:=nil;
  List:=nil;

  try
// get directory
Directory:=DirName;
//if (Macrosnil) and (not Macros.SubstituteStr(Directory)) then exit;
Directory:=AppendPathDelim(Directory);

// setup filters
SetupFilter(RemoveFilterRegExpr,false,
  Filter);
if length(exclude)  0 then
SetupFilter(KeepFilterRegExpr,false,
 exclude);

// search files
List:=TStringList.Create;
if not SearchInDirectory(Directory,0) then exit;

Result:=true;
  finally
RemoveFilterRegExpr.Free;
//KeepFilterRegExpr.Free;
if not Result then begin
  List.Free;
  List:=nil;
end;
  end;
end;

=
Any idea what else I need to change to make this general-use version
of the function work ?

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect, OpenLab International
www.getopenlab.com
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] GetFileList

2006-02-02 Thread A.J. Venter

 Macros: To search for '$(ProjectDir)/*.lfm'
 SimpleSyntaxToRegExpr: To use masks like '*.txt'

 For example SimpleSyntaxToRegExpr(FilterAsText) converts '*.txt' into the
 regular expression '^.*\.txt$'.

 If you don't want to use regular expressions you can use
 FileInFilenameMasks
 See the comment at the function body.

Thanks the function is working now with regex support, including simpleformat 
regex´s.

Now I have some new questions though. According to the tutorial on lazarus-ccr 
a thread must never update the form, does this also apply to things like 
messagedialog and showmessage ? 
Because if so, then this function is not currently threadsafe and I need to 
hack it a little more (I at least intend to use it in threads).

For the record, the final function is going into olpack, possibly with a 
wrapper component later in case anybody else wants it.

A.J.

-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] GetFileList

2006-02-02 Thread A.J. Venter

 
  Now I have some new questions though. According to the tutorial on
  lazarus-ccr  a thread must never update the form, does this also apply to
  things like  messagedialog and showmessage ?

 Yes.
 The complete painting and mouse/keyboard stuff belongs to one thread.
Thanks, so implemented, I removed the calls for those, and simply made sure 
the function will return false, to keep it threadsafe, error HANDLING will 
have to be the task of the calling programs, at least error CATCHING is 
there.

Ciao
A.J.

-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Re: TrayIcon preview

2006-02-02 Thread A.J. Venter


 There is no executable xev, and no package named xev available on the
 repositories of my Mandriva 2006.
Xev is part of the Xorg project but not all distros include it in the default 
packages, look for something called xorg-utils or such which isn't installed, 
includes all the stuff like xcalc and xev and xlsfonts which normal users 
almost never use anymore.


-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Re: TrayIcon preview

2006-02-02 Thread A.J. Venter


 On the other hand, on IceWM instead of my icon, I see some random colors
 painted and it doesn't respond to mouse events.
This may or may not be related but do an ldd on your icewm executable, icewm 
by default has ONLY support for xpm image formats (though there is a 
configure option to enable png as well). 
If you don´t see libpng in the libraries list, try doing a test program using 
only xpm images to your trayicon, that may help, barring that it may also 
imply that icewm´s image handling isn´t compatible to the LCL ways. 

Of course this is just a guess based on your description, I could be wrong.

-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Am I being too ambitious?

2006-02-03 Thread A.J. Venter
Or am I just doing it the wrong way around ?

A very large part of my dayjob involves writing frontends to commandline 
programs under linux, so of course I figured I could make my life a lot 
simpler if I had an abstract class I could use to run processes in threads
and retrieve the output live instead of having to reimplement essentially the
same code over and over.

So I began with my class, derived it from thread, built the TProcess into
the execute method and added the right synchronizations to have it update
the output as it arrives back from tprocess.

It compiles just fine.

But the moment I try to use it in a simple test program, it throws an 
async-reply exception, something I would normally only expect if threaded
code tried to update the display directly.

Any ideas where my thinking went wrong ?

The unit is attached. The call in my test program is as follows (yes I know
I am not utilizing the power of my own class, I just wanted to see if it 
WORKED).

procedure TForm1.Button1Click(Sender: TObject);
begin
  MyProcess := TThreadedProcess.Create(True);
  MyProcess.Command := Edit1.Text;
  Button1.Enabled := False;
  MyProcess.Resume;
While MyProcess.Running do
   sleep(100);
   Button1.Enabled := True;
   Memo1.Lines.Assign(MyProcess.OutPut);
   MyProcess.Free;
end;



Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect, OpenLab International
www.getopenlab.com
+27 82 726 5103
unit threadedprocess;

{$mode objfpc}{$H+}

interface
uses
  Classes, SysUtils,process;


Type
TThreadedProcess = class(TThread)
private
FRealOutPut : TStringList;
FCommand : String;
FOutPut : TStringList;
procedure UpdateOutPut;
procedure Started;
procedure AllDone;
FRunning : Boolean;
protected
procedure execute; override;
public
destructor destroy; override;
property Command : String write FCommand;
property Output : TStringList read FOutPut;
Property Running : Boolean read FRunning;
Constructor Create(isSuspended : boolean);
 end;


//procedure register;

implementation

//procedure Register;
//begin
 // RegisterComponents('OLPack',[TThreadedProcess]);
//end;

Procedure TThreadedProcess.Started;
Begin
   FRunning := True;
end;

procedure TThreadedProcess.UpdateOutPut;
Var I : Integer;
Begin
 For I := FRealOutput.Count to FoutPut.Count do
 FoutPut.Add(FRealOutPut[I]);
end;

Procedure TThreadedProcess.AllDone;
Begin
  FRunning := False;
end;

Procedure TThreadedProcess.Execute;
const
  READ_BYTES = 2048;

Var
 Process :Tprocess;
   MemStream : TMemoryStream;
  n: LongInt;
  BytesRead: LongInt;
begin
FRealOutPut := TStringList.Create;
Process := TProcess.create(nil);;
 Process.CommandLine :=  Fcommand;



 {Actually run the thing and catch the output}
  MemStream := TMemoryStream.Create;
  BytesRead := 0;

Process.Options := [poUsePipes];

  Process.Execute;
  synchronize(@Started);
  while Process.Running do
  begin
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);

// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n  0
then begin
  Inc(BytesRead, n);
  FRealOutPut.Clear;
  FrealOutPut.LoadFromStream(MemStream);
  synchronize(@updateOutPut);
end
else begin
  // no data, wait 100 ms
  Sleep(100);
end;
  end;
  // read last part
  repeat
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);
// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n  0
then begin
  Inc(BytesRead, n);
end;
  until n = 0;
  MemStream.SetSize(BytesRead);
  FRealOutPut.LoadFromStream(MemStream);
  synchronize(@UpdateOutPut);
  MemStream.Free;
 Process.Free;
 synchronize(@AllDone);
end;

constructor TThreadedProcess.Create(isSuspended : boolean);
begin
   FRunning := False;
   FOutPut := TStringList.Create;
   FreeOnTerminate := False;
   inherited Create(isSuspended);

end;

destructor TThreadedProcess.Destroy;
Begin
   FOutPut.Free;
   FRealOutPut.Free
end;


end.



Re: [lazarus] Am I being too ambitious?

2006-02-06 Thread A.J. Venter

 
  The synchronize calls shouldn't be placed inside your TThreadedProcess
  code... they should be used in the main application thread to provide
  mutual exclusion for the shared visual components.

 It's the other way round, at least in delphi: you call synchronize from
 a thread when you want the method executed in the context of the main
 thread.
That is correct, I know this much at least :) after all how can you 
synchronize from the main thread it doesn´t know what the other thread is 
doing.
Anyway I think the problem is right at the design level, the right way I think 
would be to create a tthread descendent in a unit, with an extra property 
FCommandLine which can be overwritten at instantiation time.

Pretty much what I had, but it should NOT be instantiated in the program.
Instead the same unit should contain a tcomponent descendent which 
instantiates the tthread descendent, takes its values from poperties to pass 
on to the  ththread descendent (which itself is a property) and THEN the 
thread can synchronize with a property of the tcomponent for output ?

Am I getting closer you think ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Am I being too ambitious?

2006-02-06 Thread A.J. Venter


 Mmmh, looking more closely to your code (I didn't before, I was just
 replying to the assertion that you call synchronize from the main
 thread) I don't think you should use synchronize at all (maybe a mutex
 to coordinate the access to FRunning, but even that may be overkill for
 a boolean): since you don't access the TStringList unless the process
 has ended there's no problem of simultaneous access from the main thread
 and the thread (and even if you wanted to do that I'd prefer a mutex
 over synchronize).
 In fact (not knowing the internals of the synchronize implementation, so
 I may be wrong) I cannot see how your thread can work since you're in a
 busy loop waiting for the thread to finish, so there's no way the main
 thread can schedule your synchronize call.

Okay, let me explain exactly what I wish to achieve.
I want to be able to stick a tmemo on a form, call tthreadedprocess with a 
command that takes a long time to run and has a lot of output (lets say 
¨find /¨ for an example) - and have the output scrolling into the tmemo LIVE 
as it arrives, hence the call to synchronize every time the tmemstream 
reaches 2048 bytes.

The main thread is not meant to be ANYWHERE in this class, this class is meant 
to create a thread, and then FEED the output of the tprocess to the main 
thread (in the calling appplication) LIVE.

So while it´s true that I don´t use FOutPut in this class -that is because I 
want to be able to use it in the calling application.
Having explained this, does it clarify why the code looks as it does ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Really quick question

2006-02-07 Thread A.J. Venter
Under linux, when passing a filename with spaces/special characters to a shell 
command, I would simply make sure it is wrapped in codes
eg. commandline := Comand+' '+FileName+'';

How (if at all) would I do the same under win32 ? 
If I don't need to do anything - will the above still work or do I need to 
ifdef it ?

A.J.
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Really quick question

2006-02-07 Thread A.J. Venter
On Tuesday 07 February 2006 21:56, Michael Van Canneyt wrote:
 On Tue, 7 Feb 2006, A.J. Venter wrote:
  Under linux, when passing a filename with spaces/special characters to a
  shell command, I would simply make sure it is wrapped in codes
  eg. commandline := Comand+' '+FileName+'';
 
  How (if at all) would I do the same under win32 ?

 The same, if you pass it to cmd.

  If I don't need to do anything - will the above still work or do I need
  to ifdef it ?

 Not if you pass it to cmd.

Well I am passing to a tprocess, and I did notice it opening cmd windows, so 
worst case scenario it will cause an issue if we're talking windows 98 or 
earlier ? Which I am not very concerned about
(and look at me, I LEARNED to code on linux and I'm lost whenever I try to 
port anything :p )
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Really quick question

2006-02-09 Thread A.J. Venter

 I can second this, don't forget on WIn98 the shell is named command,
 on 200 and XP it is cmd and if you start it with command /? it'll
 tell you what options are accepted. Some of them are really helpful e.g.
 for debugging.

Okay now two related questions
1: Can I somehow tell a tprocess under windows which is launching a non-GUI 
backend command to NOT open a cmd/command window ? Especially since the 
command being run is non-interactive, the window closes as soon as it's done 
but it just looks ugly.
2: So how do I specify advanced vfat file/directorynames in OP code ? E.G. to 
let my installer create an installdir under Program Files  - how would I mask 
out the space so OP knows its ONE directory name ? 

A.J.
-- 
A.J. Venter
Chief Software Architext
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Who Discussed Linker Slowness?

2006-02-13 Thread A.J. Venter
On Monday 13 February 2006 17:55, Lord Satan wrote:
  Is anybody using a way around or are you all day waiting?

 The way around is running under Linux where linking is much faster.
 As often said the speed problems are caused by the GNU linker and AFAIK
 there is no way to solve this other than writing a new linker.

I was the one who first pointed this out, and I can give you a few insights, a 
large part of the speed issue is with the way GNU ld seems to treats 
(lazarus?) sources and their libraries. Linking speed become a direct factor 
of how much ram you have.
My little 128mb laptop starts swapping like a maniac while linking and can 
take 30 minutes on anything with more than a few basic widgets, same code on 
my desktop (2GB of ram) takes about 3 seconds.

What I did find is that the best way to up the linker speed when you don´t 
have a lot of ram is to write a wrapper script in /usr/bin (I called mine 
nicefpc) which will launch ppc386 with a much lower nice value (I used -18)
then give it the suid bit so it can actually be launched and pass ppc386 a $* 
(so it gets all the parameters) and then tell lazarus to use nicefpc as it´s 
compile command. 
This ONLY works under linux but with the nice value way below everything else 
ppc386 and it´s spawns (like ld) all get maximum priority for memory and CPU 
access.
Just don´t try to read mail while compiling :)
Of  course this works only under linux, dunno if there is a way to do 
something similiar on win32.

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: RES: [lazarus] Who Discussed Linker Slowness?

2006-02-13 Thread A.J. Venter
On Tuesday 14 February 2006 04:56, Henrique de Paula Faria wrote:
 Vincent, can you give some tip on how to configure the publish project to
 strip and upx the executable ?

 Henrique.


You can strip and upx from the project options as well, (using the postbuild 
command and the compiler settings in conjunction).

But it is NOT an answer !

Strip - rips out debugging code - NOT static linking !
UPX compresses the executable - in a NOT AS COMPATIBLE/SAFE AS THEY SAY way.

I know, I used to use UPX, I have seen how badly it goes wrong when it does - 
apps that simply won´t run after being compiled...

These are work-arounds to the REAL issue which is that by default lazarus 
links statically. Smartlinking takes longer but it is the right way(tm).
You should STILL strip any program you are distributing but THAT is just 
standard software distribution policy - debugging symbols are for building, 
not for shipping.
In other words, it´s the size of the executable AFTER stripping we should be 
concerned about.  An outside executable compresor may or may not  be usefull 
to you but depending on one is a bad thing(tm) and CERTAINLY not as a 
work-around for static linking. The fact that lazarus is meant to be 
multiplatform and that the number of support platforms are increasing makes 
this doubly important.

I know that ppc386 can take a commandline option to tell it whether or not to 
smartlink, though I don´t know if this can just disable compiler directives 
for smartlinking or if it can replace them.
Correctly used however, that is the answer, publish project should smartlink 
the code, if smartlinking is to slow then the normal run-build-run version 
should static link your program. The LCL needs to be smart linkable, but I 
don´t think it always needs to be smartlinked.
You should be able to static link during development.

Ciao
A.J.

PS. Dynamic linking is not even an option to me - the last thing I want is for 
my lazarus programs to start behaving like kylix programs and insist you load 
about 12 other library packages which may or may not have been built for your 
glibc depending on whether borland was in a good mood that day.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] forms maximizing

2006-02-16 Thread A.J. Venter
On Thursday 16 February 2006 11:42, Pēteris Bērzs-Bērziņš wrote:
 Hi maybe some one can help me with advice.
 I wana make my main form like Delphi, Lazarus. On top on the screen, but on
 maximizing it goes under start bar witch is on top. See attached file.
Strange, I have programs which does this (see olpack´s tscreensize component 
on silentcoder.co.za) and this has never happened with them. I would guess it
´s the window manager that is responsible for it, I know that under KDE it 
won´t go behind or over the taskbar but will just stop dead against it. 

Unless you are trying to go for fullscreen mode which I am pretty sure will 
require a call to gtk_wm_hint  stopping against the taskbar has always been 
how I defined maximized.
Mind you it may be possible to use a wm_hint call in your oncreate event to 
tell the window manager to maximise it for you ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] lightweight http

2006-02-22 Thread A.J. Venter

On Wednesday 22 February 2006 03:33, Juan Martinez wrote:
 Ales Katona [EMAIL PROTECTED] escribió:  Juan Martinez wrote:
  Hi all
 
  I'm looking for a very lightweight http component, I don't need
  browser capabilities, even not html procesing, just sending, receiving
  and parsing http headers are needed. Anyone knows about such a component?
 
  I've seen httpclient unit in the fcl, but I don't know how to use it.
Have you considered CurlPas - it's not exactly lightweight but it can be used 
in a lightweight manner and it's available and it works :) 

Ciao
A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] lightweight http

2006-02-22 Thread A.J. Venter
On Wednesday 22 February 2006 18:21, A.J. Venter wrote:
 On Wednesday 22 February 2006 03:33, Juan Martinez wrote:
  Ales Katona [EMAIL PROTECTED] escribió:  Juan Martinez wrote:
   Hi all
  
   I'm looking for a very lightweight http component, I don't need
   browser capabilities, even not html procesing, just sending, receiving
   and parsing http headers are needed. Anyone knows about such a
   component?
  
   I've seen httpclient unit in the fcl, but I don't know how to use it.

 Have you considered CurlPas - it's not exactly lightweight but it can be
 used in a lightweight manner and it's available and it works :)

Sorry, I pasted the wrong link - this one is more appropriate to your needs:
http://curlpas.sourceforge.net/curlpas/index.html

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] TListView.CustomSort

2006-02-22 Thread A.J. Venter
Hi, 
It seems that the lazarus tlistview's do not implement the customsort method - 
not even as a virtual, the result is that all the tutorials I could find on 
how to sort a tlistview by a columnclick do not work with lazarus since they 
all rely on tcustomsort (and I presume OnCompare).

Is this a TODO ? Or is there a different way to do this in Lazarus ? 

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TListView.CustomSort

2006-02-22 Thread A.J. Venter
On Wednesday 22 February 2006 21:14, Marc Weustink wrote:
 A.J. Venter wrote:
  Hi,
  It seems that the lazarus tlistview's do not implement the customsort
  method - not even as a virtual, the result is that all the tutorials I
  could find on how to sort a tlistview by a columnclick do not work with
  lazarus since they all rely on tcustomsort (and I presume OnCompare).
 
  Is this a TODO ? Or is there a different way to do this in Lazarus ?

 This is a todo. I tried to implement sorting, read about it on how to do
 it on gtk and found that it differs much from win32. So I tried to find
 a nice way were both would fit in a VCL compatible way. And then I had
 other business or so.

Okay then, so basically right now the only way would be to clear, create a 
sorted list and refill ? 
I suppose that can work as a temporary measure since sorting in my app is 
actually quite critical, unless somebody has a better idea.
(This is for OpenBook - to allow people to sort search results by a field of 
their choice - obviously it would hugely improve the overall usability).

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TListView.CustomSort

2006-02-22 Thread A.J. Venter
On Wednesday 22 February 2006 21:30, Jesus Reyes wrote:
 Have you considered using a stringgrid? or some derived from it like
 TSemaphorGrid (lazarus/examples/grid_semaphor)

I looked at them right in the beginning, but I don't think they will be able 
to do what I am after look and feel wise (this: 
http://www.silentcoder.co.za/tiki/show_image.php?id=568)

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TListView.CustomSort

2006-02-22 Thread A.J. Venter


 I don't see anything in the screenshot that TStringGrid can't do :D

 Jesus Reyes A.
Okay, I must be stupid then :)
I always rather thought of TStringGrid as a tool for letting users INPUT data, 
while TListView is a tool for PRESENTING data that must not be editable - I 
think users might be confused by the spreadsheet like cells if they cannot 
edit them.
Though to be honest the biggest single reason is probably that I have hardly 
ever used the stringgrid components so I don't actually know them very well 
and the idea of rewriting the population code in it scares me a little :)

Mind you if you feel like contributing to a free software project by doing the 
conversion for me - well I never say no to useful contributions :p

Okay, enough contrib-whoreing, you may just be right though - and I should 
probably just go ahead and figure it out. 

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TListView.CustomSort

2006-02-22 Thread A.J. Venter
On Wednesday 22 February 2006 22:29, Micha Nelissen wrote:
 On Wed, 22 Feb 2006 22:22:04 +0200

 A.J. Venter [EMAIL PROTECTED] wrote:
  Mind you if you feel like contributing to a free software project by
  doing the conversion for me - well I never say no to useful contributions
  :p
 
  Okay, enough contrib-whoreing, you may just be right though - and I
  should probably just go ahead and figure it out.

 I do have to remark that a TListView is more native than a StringGrid. At
 least, on windows xp a listview looks much nicer. A stringgrid is always
 completely LCL-drawn.
Having now taken a much more indepth look at tstringgrid, I think it could 
work - but only at the cost of hugely complexifying my program - unless 
somebody is really eager to do it for me, I don't think it's worth it. I 
would rather help with implementing sorting for tlistview so I can have it 
for my next version.

My feel btw: to keep code platform neutral, don't use the native sorting 
methods, but do a sort based on pure data manipulation. I could even do that 
in the app (as opposed to a clear and refill method) although that is harder 
to do it is certainly not impossible and a quicksort is practically the first 
algorithm any of us learned after all :)

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TListView.CustomSort

2006-02-22 Thread A.J. Venter
On Wednesday 22 February 2006 22:55, Jesus Reyes wrote:
   Okay, enough contrib-whoreing, you may just be right though - and
 
  I should
 
   probably just go ahead and figure it out.

 No problem, send me some code to convert and I will try, if you
 doesn't like it (see below), you can always try to do the sorting as
 you alredy planned and continue with Tlistview :)

Well in that case, you can check out the code from my subversion server:
svn co svn://silentcoder.co.za/tools/openbook

You will also need to checkout and install my component packs:
svn co svn://silentcoder.co.za/lazarus
In order to actually compile it as it uses both olpack and gzpack quite 
extensively (though not for anything that affects what you are looking at).

The code tree includes samples of all the needed support files including an 
index (though not the nearly 4gb of data it is an index FOR of course - but 
you shouldn't need that for testing - just verifying that the thing opens 
with the right parameters ought will do it).

For the rest it should be fairly simple to make sense of but shout if you want 
to check anything, I am also on IM:
Yahoo: silentcoder
Jabber: [EMAIL PROTECTED]
MSN: [EMAIL PROTECTED]

Ciao and thanks
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TListView.CustomSort

2006-02-22 Thread A.J. Venter
 Ciao and thanks
 A.J.

Sorry about that, I intended to mail Jesus directly and forgot that lazarus 
uses reply-to setting.

A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Enhanced versions of TStringGrid

2006-02-23 Thread A.J. Venter

 
  Being said that, I think your final question remains open to others
  wanting to participate on ideas of enhancement, deriving or whatever :)

 I think, Michael already gave a nice solution: Let's implement a plugin
 system for grids.
 See SynEdit for an example.
 For the hook lists see TControl.AddHandler.
 It should be possible to write plugins for cell drawing, cell editors,
 sorting, navigation and data connections.

I like this idea as well (sorry if this is a me-too post :p), the concept of 
having a single top-level grid component, into which you can then plug those 
features needed by your application makes far more sense to me than having a 
dozen grid components each with one extra feature.
I would even suggest that TDBGrid should be dropped and it's functionality 
turned into a plugin for this top-level grid component. Unless of course 
people feel that would break too much compatibility/familiarity for former 
delphi users.

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Why is this throwing an exception ?

2006-02-23 Thread A.J. Venter
So there I was, thinking today, what can I do to once more save future time... 
and I realised that something I would really like is to have a component that 
can wrap around ipro and implement a simple file-based html viewer with image 
support, jpeg loading and such built-in.

Easy right, after all just that exists in the example shipped for it, so all I 
have to do is plagiarise the code a bit and create a component out of it. 

So I created my component and added the bits I wanted, mostly just a property 
for specifying an html file and a method for showing it. 

And it works, even jpg's load fine.
But immediately after loading it throws an exception, ignore the exception and 
it throws it again, and again and again (no idea is given of WHAT exception).
The frequency and timing does however suggest that the exception is thrown 
during the onpaint event (though I never TOUCHED that :p )

Anyway, here is the code:
unit simple_html;
{A simple file based html viewer component based on ippro with image viewing 
added}

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics,IPHtml,lazjpeg;

type

  TSimpleIpHtml = class(TIpHtml)
  public
property OnGetImageX;
  end;
  
  
   TSimpleHTML = class(TIpHtmlPanel)
  private
 FHtmlFile : String;
 FNewHTML: TSimpleIpHtml;
  public
{ public declarations }
  procedure HTMLGetImageX(Sender: TIpHtmlNode; const URL: string; var 
Picture: TPicture);
  procedure ShowFile; {Loads a designtime set html file}
  destructor destroy; override;
 published
 { published properties }
 constructor create(AOwner: TComponent); override;
 property HTMLFile : String Write FHtmlFile;
  end;

procedure register;

implementation
{TSImpleHTML}
procedure Register;
begin
  RegisterComponents('OLPack',[TSimpleHTML]);
end;
procedure TSimpleHTML.HTMLGetImageX(Sender: TIpHtmlNode; const URL: string;
  var Picture: TPicture);
var
  PicCreated: boolean;
begin
  try
if FileExists(URL) then begin
  PicCreated := False;
  if Picture=nil then begin
Picture:=TPicture.Create;
PicCreated := True;
  end;
  Picture.LoadFromFile(URL);
end;
  except
if PicCreated then
  Picture.Free;
Picture := nil;
  end;
end;

procedure TSimpleHTML.ShowFile;
var
  fs: TFileStream;
begin
 if FileExists(FHtmlFile) then
  try
fs:=TFileStream.Create(FHtmlFile,fmOpenRead);
try
  FNewHTML.OnGetImageX:[EMAIL PROTECTED];
  FNewHTML.LoadFromStream(fs);
finally
  fs.Free;
end;
   SetHtml(FNewHTML);
  except
on E: Exception do begin
  Writeln('Unable to open HTML file',FHtmlFile);
end;
  end;
end;




destructor TSimpleHTML.destroy;
Begin
  inherited;
end;

constructor TSimpleHTML.create(AOwner: TComponent);
begin
 FNewHTML:=TSimpleIpHtml.Create;
  inherited;
end;
end.

---
Here is the relevant parts from a simple demo program I did to test it:
  TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
OpenDialog1: TOpenDialog;
SimpleHTML1: TSimpleHTML;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);

procedure TForm1.Button2Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
   Edit1.Text := OpenDialog1.Filename;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  SimpleHTML1.HTMLFile := Edit1.Text;
  SimpleHTML1.ShowFile;
end;

---
Anybody here familiar enough with ipro to know what I am doing wrong ?

Ciao
A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: Why is this throwing an exception ?

2006-02-23 Thread A.J. Venter
Sorry, forgot to add, here is the stack trace as well:

TApplication.HandleException Access violation
  Stack trace:
  $0820B073  TIPHTMLINTERNALPANEL__HTMLPANEL,  line 15979 of iphtml.pas
  $08209DA0  TIPHTMLINTERNALPANEL__MOUSEMOVE,  line 15523 of iphtml.pas
  $0810D156  TCONTROL__WMMOUSEMOVE,  line 2882 of ./include/control.inc
  $0805CEF7
  $0810A30E  TCONTROL__WNDPROC,  line 1542 of ./include/control.inc
  $08101D49  TWINCONTROL__WNDPROC,  line 3347 of ./include/wincontrol.inc
  $08109224  TCONTROL__PERFORM,  line 1014 of ./include/control.inc
  $08100C14  TWINCONTROL__ISCONTROLMOUSEMSG,  line 2823 
of ./include/wincontrol.inc
  $08101CD9  TWINCONTROL__WNDPROC,  line 3328 of ./include/wincontrol.inc
  $0811E965  DELIVERMESSAGE,  line 3457 of gtkproc.inc
  $08126CC2  DELIVERMOUSEMOVEMESSAGE,  line 867 of gtkcallback.inc
  $08126D67  GTKMOTIONNOTIFY,  line 920 of gtkcallback.inc
  $401E164D  SYNREGEXPR_finalize_implicit,  line 936 of 
gtkglobals.ppiphtml.pas
  $40210E5A  SYNREGEXPR_finalize_implicit,  line 936 of 
gtkglobals.ppiphtml.pas
  $4021016A  SYNREGEXPR_finalize_implicit,  line 936 of 
gtkglobals.ppiphtml.pas
  $4020E234  SYNREGEXPR_finalize_implicit,  line 936 of 
gtkglobals.ppiphtml.pas
  $40243FD9  SYNREGEXPR_finalize_implicit,  line 936 of 
gtkglobals.ppiphtml.pas


-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: Why is this throwing an exception - ANSWER

2006-02-23 Thread A.J. Venter
It's a bug in ipro.
I checked the code at the stack trace and found this:
function TIpHtmlInternalPanel.HtmlPanel: TIpHtmlCustomPanel;
begin
Result := TIpHtmlPanel(Parent);
  while (Result.ClassType  TIpHtmlPanel) do
Result := TIpHtmlPanel(Result.Parent);
end;

The exception gets thrown in the while line.

Now WHY they do it this way I do not know, but it means you get a real problem 
if you derive a component from it.
I commented out the lines in the function like so:
function TIpHtmlInternalPanel.HtmlPanel: TIpHtmlCustomPanel;
begin
//Result := TIpHtmlPanel(Parent);
//  while (Result.ClassType  TIpHtmlPanel) do
//Result := TIpHtmlPanel(Result.Parent);
end;

And now my test program works as beautifully as you could wish.

From the context I get the idea this is somehow used if you wish to embed two 
htmlpanels inside one another, which doesn't affect me - but the method they 
are using is NOT good because it causes crashes if you derive anything (which 
changes the classtype of course).

So do I report a bug ? Or how does this get fixed ?

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: Why is this throwing an exception - ANSWER

2006-02-25 Thread A.J. Venter

 
  So do I report a bug ? Or how does this get fixed ?

 Please check above fix. If it works, I will change it.

Well I have since redesigned my entire component so it is no longer descended 
from TIpHtmlPanel, and it is in a fully working state based on a very 
different approach. However I do think the fix should be applied because I am 
doubtlessly not the last person to try and descend the class :)

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] transparent forms

2006-02-26 Thread A.J. Venter


 How does it work? Does it scan the form and build a region or so? Sounds
 like a horrible hack to me TBH. How do you use it ?

Well there are a few ways one could achieve this, the worst hack being to have 
the code scan the form and copy whatever is behind it on screen onto the 
section you selected, that is a horrible way.
Now on MacOSX and Linux (at least with newer versions of X) it should be 
possible to do TRUE translucency. On linux by tapping into the Xcomposite and 
Xrender extensions, not sure how you get to these features on Mac. On windows 
I don't know but different implementations for supported platforms is quite 
okay if the interface to the component is the same.

I do think it would be a nice-to-have but right now I doubt there is a clean 
multiplatform approach so a per-platform implementation would  be needed and 
it's not lazarus style to add components that work only in one place.

I do reckon that a lazarus component which can tap into the features of 
xcomposite manager would be really neat though, not sure what it would take 
to create one, especially if you don't want to use a tprocess, I suspect our 
X-header conversions don't include the functions it uses so it may require 
converting some code from the c project by X.org.
Of course it won't work on all versions of X only those that have the right 
support compiled in (which is alpha code right now) but it would mean that 
where available lazarus apps can be xgl enabled, users could have a slider 
right in the app for adjusting transparency... neat nay (of course I think 
this will be whole-form only though it could surely be mapped into a 
component as well to affect only that which is in the bounds of the component 
- personally I would like both - the component could have a slider letting 
the user adjust the transparency of the region it encapsulates (and otherwize 
look and work like say a tgroupbox) and another component which would be 
simpler and probably non-visual but would adjust full form transparency to 
whatever value you pass it in properties) 

Wow that was a lot of bracing :p

Anyway, just some thoughts from me on the topic. Others ?

Ciao
A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: Why is this throwing an exception - ANSWER

2006-02-26 Thread A.J. Venter
Patch as per Mattias' suggestion attached, 
I tested it and verified that it fixes the problem allowing derivative 
components of ipHtmlPanel to be created and used.

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103
Index: components/turbopower_ipro/iphtml.pas
===
--- components/turbopower_ipro/iphtml.pas	(revision 8812)
+++ components/turbopower_ipro/iphtml.pas	(working copy)
@@ -15976,7 +15976,7 @@
 function TIpHtmlInternalPanel.HtmlPanel: TIpHtmlCustomPanel;
 begin
   Result := TIpHtmlPanel(Parent);
-  while (Result.ClassType  TIpHtmlPanel) do
+   while not (Result is TIpHtmlPanel) do
 Result := TIpHtmlPanel(Result.Parent);
 end;
 
Index: components/fpcunit/Makefile.fpc
===
--- components/fpcunit/Makefile.fpc	(revision 8812)
+++ components/fpcunit/Makefile.fpc	(working copy)
@@ -7,7 +7,7 @@
 [compiler]
 unittargetdir=lib/$(CPU_TARGET)-$(OS_TARGET)
 unitdir=../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
-options=-dLCL -dLCLgtk -S2 -gl
+options=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 
 [target]
 units=fpcunittestrunner.pas
@@ -18,6 +18,16 @@
   $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) \
   $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) \
   $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
+[prerules]
+# LCL Platform
+ifndef LCL_PLATFORM
+ifeq ($(OS_TARGET),win32)
+LCL_PLATFORM=win32
+else
+LCL_PLATFORM=gtk
+endif
+endif
+export LCL_PLATFORM
 
 [rules]
 .PHONY: cleartarget all
Index: components/fpcunit/Makefile
===
--- components/fpcunit/Makefile	(revision 8812)
+++ components/fpcunit/Makefile	(working copy)
@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/01/19]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/12/07]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
@@ -231,6 +231,14 @@
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 override PACKAGE_NAME=fpcunittestrunner
 override PACKAGE_VERSION=0.1
+ifndef LCL_PLATFORM
+ifeq ($(OS_TARGET),win32)
+LCL_PLATFORM=win32
+else
+LCL_PLATFORM=gtk
+endif
+endif
+export LCL_PLATFORM
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_UNITS+=fpcunittestrunner.pas
 endif
@@ -454,115 +462,115 @@
 override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
 endif
 ifeq ($(FULL_TARGET),i386-linux)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL

Re: Why is this throwing an exception - ANSWER

2006-02-26 Thread A.J. Venter


 I applied only the ippanel change.

As far as I know that should have been the only one anyway though it seems the 
tutorial on patch creation should be expanded to include make clean before 
creating a patch.

A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TListBox and Font properties

2006-02-26 Thread A.J. Venter
On Sunday 26 February 2006 21:36, Panagiotis Sidiropoulos wrote:
  AFAIK it is not yet implemented in the LCL gtk2 interface, only in the
  LCL gtk1 and win32 interface.

 Does it need any special implementation? Why this for gtk1 can't work on
 gtk2? Maybe it is a silly question, I don't know. How someone can find
 infromation on how to do such things?

The short version is because the LCL is NOT the interface it is using, lazarus 
compiling to GTK1 does not mean you are using GTK1. You are still compiling 
your program against the LCL, the LCL uses some or other widget set for 
rendering but the LCL itself has to implement the calls to let that widget 
set do whatever is needed. 
Right now I believe the win32 and GTK1 interfaces are by far the most complete 
since they are the oldest ones, carbon, qt and gtk2 are all in a much more 
immature state. 
The big thing is that you have the Object Pascal way of telling components how 
to behave on one side, and whatever method is typical in the widget set on 
the other side - the LCL basically translates the one to the other - so the 
translation to GTK1 for ownerdraw isn't the same as for GTK2 because GTK2 
doesn't use the same calls as GTK1 did.

With me so far ?

Right now GTK2 is actually more complete than QT and Carbon mostly because a 
lot of the calls are similar to the highly mature GTK1 which allowed for a 
faster conversion, but it is not I think production ready. 
I have tried it and there are some glaring problems, the worst for me is that 
the GTK2 LCL has some kind of issue in event handling - a LOT of events just 
disappear into the bitbucket and nothing annoys a user as much as clicking a 
button and nothing happens, it is also MUCH slower than the GTK1 version but 
it IS improving and I don't think it will be very long before you CAN use it 
for production work.

Now, you seem interested in helping to shorten that time, the place to start 
is the layout and readme text files in the LCL subdirectory of your lazarus 
source tree, get an idea of how the LCL interfaces are laid out, then go into 
the subdirectory that implements your target widget set and start hacking the 
code, when you are done, recompile lazarus and try it out, repeat.

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter
Hi all,
Probably the most requested feature for tappytux is that the entry line where 
users type answers needs to be bigger (I mean huge) and prettier, using 
something like Comic Sans font at size 32 should do it, but of course lazarus 
provides no means of setting fonts and gtkrc seems to only be able to do it 
globally - not for one widget type only.

Which is why I am thinking that what I would need to do is create a component 
that is canvas drawn and knows how to output text in the font type of your 
choosing, in fact I think textout to a color-painted region might almost do 
it, however there is a catch, the component HAS to be UTF-8 enabled because 
tappytux is VERY internationalised and UTF is just about the only way to do 
that cleanly.
Now for the most part textout DOES display UTF-8 but the hard bit is input.
I have no idea how UTF-8 is mapped to keycodes, if I know how to handle an 
onkeydown event for a component in such a way as to ensure that the character 
displayed is what was actually TYPED (which includes handling things like Del 
and Backspace right) then my problem is solved. Of course such a component is 
sufficiently generically usefull that I imagine others would bennifit as well 
and as always I will lgpl it.

Any advice on how it should work ? What it should be descended from and how to 
get from input to screen ?

Ciao
A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter
On Monday 27 February 2006 10:47, Micha Nelissen wrote:
 A.J. Venter wrote:
  Hi all,
  Probably the most requested feature for tappytux is that the entry line
  where users type answers needs to be bigger (I mean huge) and prettier,
  using something like Comic Sans font at size 32 should do it, but of
  course lazarus provides no means of setting fonts and gtkrc seems to only
  be able to do it globally - not for one widget type only.

 Are you sure gtk is really incapable of showing a different font for
 certain widgets ? IIRC Darek implemented Color property for some
 widgets, so I guess fonts should be possible as well. (But I have no gtk
 experience).

 If this is possible, then this is *the* way to go.

I spent about 4 hours last night reading gtkrc howto´s and studying existing 
theme files and thus far I cannot find anything to do this, even then it 
STILL requires an external gtkrc file, I think a component for those cases 
where you do need it would be very usefull, the same way a tstatictext can be 
used instead of a tlabel when you just need output.

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter
On Monday 27 February 2006 11:40, Mattias Gaertner wrote:
 On Mon, 27 Feb 2006 11:15:03 +0200

 A.J. Venter [EMAIL PROTECTED] wrote:
  On Monday 27 February 2006 10:47, Micha Nelissen wrote:
   A.J. Venter wrote:
Hi all,
Probably the most requested feature for tappytux is that the entry
line where users type answers needs to be bigger (I mean huge) and
prettier, using something like Comic Sans font at size 32 should do
it, but of course lazarus provides no means of setting fonts and
gtkrc seems to only be able to do it globally - not for one widget
type only.
  
   Are you sure gtk is really incapable of showing a different font for
   certain widgets ? IIRC Darek implemented Color property for some
   widgets, so I guess fonts should be possible as well. (But I have no
   gtk experience).
  
   If this is possible, then this is *the* way to go.
 
  I spent about 4 hours last night reading gtkrc howto´s and studying
  existing  theme files and thus far I cannot find anything to do this,
  even then it  STILL requires an external gtkrc file, I think a component
  for those cases  where you do need it would be very usefull, the same way
  a tstatictext can be  used instead of a tlabel when you just need output.

 I just tried under linux/gtk1: Setting a TEdit font size to 30 gave a a
 huge font.

Then this may be the right way, although I am using GTK2 here (I need the 
pango UTF support), and gtk_rc_parse will allow me to force a specific theme 
file. 
How exactly does your line look ? Any idea how I need ot change it to use 
GTK2 ? Or did you do this in code ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter


  Any idea how I need ot change it to use GTK2 ? Or did you do this in code
  ?

 I did it in the designer and it works at runtime with gtk1.
 For gtk2:
 This needs to be implemented in gtkobject.inc TGtkWidgetSet.SetWidgetFont.

I am studying that file now, thinking off it, my way wouldn´t work anyway, 
without SetWidgetFont there isn´t any real way for a custom component to 
force it´s font either (except perhaps for direct GTK2 calls in which case I 
may as well just do it for the LCL and be done with it).

Not being a GTK guru I am a little lost but mostly understanding what the code 
is meant to be doing and I am fairly certain that (some of) the code in 
PangoDrawText can be used to implement this (since I need it, I am happy to 
try at least), what I do need however is some idea of how it should work, 
where is it defined ? Procedure ? Function (result type) ?

Unfortunately the lazarus-ccr seems to be down (could be my ISP though) so I 
cannot look it up there and I cannot find such a function in the GTK1 file of 
the same name at all. 

I assume it´s specified somewhere else ? Presumably the same place where the 
debugln for setWidgetFont comes from.

Anybody up for helping me ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Cannot run r8833

2006-02-27 Thread A.J. Venter
Not sure how far back this goes because I only update ever few days, but I 
cannot run this version, after a clean build, lazarus begins to start, shows 
the splash screen and the lazarus editor window and freezes (nothing ever 
gets painted IN the editor window).

On the shell the last output is:
TMainIDE.DoNewEditorFile A Filename=

Thereafter absolutely nothing happens, I did an strace but I couldn´t figure 
out what it was trying to do, just that it didn´t actually do anything beyond 
that point. 
At first I thought it was just my home machine but now I have the same result 
at the office. Obviously I cannot try to do the font stuff until this 
happens, it could mean some new incompatibility with openlab
(I did test - removing $HOME/.lazarus had no impact nor does trying to run it 
as root), though I wouldn´t know where to start looking, let me know if I can 
provide any usefull information like LDD outputs or something.

Note that at this stage we are just talking about a clean make, no GTK2 or 
anything yet, not even any extra packages.

Ciao
A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter
Well I did some research and the GTK way of doing it is really very simple, 
except that the method (modify_font) doesn´t seem to exist in PGTKWidget 
which I surmise is because the definition of THAT is taken from the GTK1 
definition.
According to the GTK2 docs, all GTK2 widgets derive from GTKWidget and should 
inherrit modify_font which can set any pangoFontDescription, the only 
remaining part is to convert a tfont TO a PangoFontDescription (well 
PPangoFontDescription actually).

So the RIGHT way I believe is to enable the method, presumably by descending 
PGTKWidget to create PGTK2Widget (oddly TGK2Widget exists but TGKWidget does 
not) - which may have the inadvertent side effect of meaning that damn near 
every bit of GTK needs to have it´s type definitions altered to call and use 
the derived class, either that or GTK2 should simply overWRITE the PGTKWidget 
definition with it´s own version that enables the GTK2 specific features.

Thoughts anyone ?

Ciao
A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: Why is this throwing an exception - ANSWER

2006-02-27 Thread A.J. Venter
On Monday 27 February 2006 18:19, Vincent Snijders wrote:
 A.J. Venter wrote:
 I applied only the ippanel change.
 
  As far as I know that should have been the only one anyway though it
  seems the tutorial on patch creation should be expanded to include make
  clean before creating a patch.

 That would not have helped in this case, because most of your changes were
 because of local changes to files in the repository.

 Vincent.

Then I really dunno what I did wrong because that was the ONLY changed file at 
the time, at least the only one *I* had changed - does lazarus change files 
during runtime or installing of packages ?
How SHOULD I have created the patch ?

A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter

 
  If this is possible, then this is *the* way to go.

 At least I know it is possible for gtk2 - I implemented dynamic fonts in
 one of my (C++, unfortunately) programs. The documentation seems to talk
 about the font code as something New and Improved (tm), so I'd say it's
 quite hard in gtk1.
Well I could find the documentation on how to do it, but the actual method 
isn't implemented somewhere, it is not impossible that the PLACE where it is 
missing is in the FPC units, but since those were autogenerated my gutt tells 
me that it is more likely to be somewhere in the LCL.

I am not exactly sure how the GTK2 objects were turned into OP classes for the 
LCL, I would have to look at the wrapper code first, my feeling however is 
that the likely scenario is that somewhere an external declaration needs to 
be added that can enable GTKWidget.Modify_font from the GTK2 libs.

GTK1 already has support for this, and if I I didn't REALLY need UTF-8 support 
for text-out I would have just compiled my app for GTK1 instead but since I 
don't know how, and it would be GREAT if this works, I am happy to help write 
code to make it happen, if I can get help from some of the gtk2 guru's it 
would just happen faster. 

My current code:
In gtk2object.inc add this (I put mine just above TGTKWidget.SetCallBack):
Procedure TGTK2WidgetSet.SetWidgetFont(const AWidget: PGTK2Widget; const 
Afont: tFont);
Var
  PangoDescStr,DescOpts : String;
  NewFontDescription : PPangoFontDescription;

Begin
{$IFDEF GTK2}
PangoDescStr := AFont.Name;
DescOpts := '';
  If FSBold in AFont.Style then
DescOpts := DescOpts + ' bold';
  If FSItalic in AFont.Style then
DescOpts := DescOpts + ' italic';
  If FSUnderline in AFont.Style then
DescOpts := DescOpts + ' underline';
  If FSStrikeOut in AFont.Style then
DescOpts := DescOpts + ' strikethrough';

   PangoDescStr := PangoDescStr+DescOpts+' '+intToStr(Afont.Size);
//Pango does not appear to have a way to set the character set in the
//font description but seems to default to UTF-8 this probably
//requires some or other todo item.
try
NewFontDescription := PPangoFontDescription(PangoDescStr);
AWidget.Modify_Font(NewFontDescription);

except
debugln('COULD NOT SET FONT');
end;
{$ENDIF}
end;


In GTK2Int.pas  change
  protected
procedure AppendText(Sender: TObject; Str: PChar);
to:
  protected
procedure SetWidgetFont(const AWidget: PGTK2Widget; const Afont: tFont);
procedure AppendText(Sender: TObject; Str: PChar);

Note that the current code DOES NOT COMPILE due to the missing Modify_Font.

PS. Thanks Darek, I managed to get THIS far by studying your patch and will 
look at it again when doing the per-widget bits.

PPS. As you can see, right now tfont.color is NOT yet handled at all.

Ciao
A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter

 Correct.
 There must be already such a function, but I'm not sure if it works good.
 There are a lot of font issues in the gtk2 interface.
Well if it's there, it's not there under the same name :)

  So the RIGHT way I believe is to enable the method, presumably by
  descending  PGTKWidget to create PGTK2Widget (oddly TGK2Widget exists but
  TGKWidget does  not) - which may have the inadvertent side effect of
  meaning that damn near  every bit of GTK needs to have it´s type
  definitions altered to call and use  the derived class, either that or
  GTK2 should simply overWRITE the PGTKWidget  definition with it´s own
  version that enables the GTK2 specific features.

 I'm not sure what this TGTK2Widget is.
It is defined in gtk2int.pas and seems to to be the parent widget for gtk2 
widgets, except it's a LOT shorter than the TGTKWidget definition in 
gtkint.pas (this was where I had to add the procedure definition for 
setWidgetFont), and it doesn't seem to be derived, 
I have not found any reference to PGTK2Widget however leading me to presume it 
doesn't exist, the procedure reference right now uses PGTKWidget since that 
is what I got from Darek's patch, but I am fairly certain that it DOES need 
to change to be a pointer to a TGK2Widget, I am still trying to figure out 
where to DO that though, it is not impossible that defining PGTK2Widget and 
making whatever changes is needed to allow SetWidgetFont calls under GTK2 to 
pass the right type will solve the problem entirely - of course a GTK2 only 
method won't exist if we are using a GTK1 class definition to refer to the 
widget objects in calls. 


Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter

  try
  NewFontDescription := PPangoFontDescription(PangoDescStr);
  AWidget.Modify_Font(NewFontDescription);

 I will take a look ...

Mucios Gracias Amigo.

A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Pretty looking TEdit

2006-02-27 Thread A.J. Venter
On Monday 27 February 2006 18:51, Mattias Gaertner wrote:
   font_desc:=pango_font_description_from_string(PChar(PangoDescStr));
   gtk_widget_modify_font(AWidget,font_desc);
   pango_font_description_free(font_desc);          

Right my patch is ALL BUT complete, one thing is missing though, 
This code FAILS is tfont.name is set to Default, I need to CATCH that and give 
it a SANE default font name in that case,
what should I use ? 
Ideally it should be whatever lazarus normally uses.

A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] GTK2 Font patch - build 1

2006-02-27 Thread A.J. Venter
This is very nearly ready, but it still has two bugs I don't know how to fix - 
hopefully though it will provide enough of a basis that somebody can help me 
finish it off.

Bugs:
1) Tedit doesn't display unless the font is EXPLICITELY set (e.g. my current 
catch code doesn't seem to work for it)
2) TLable sets the font at designtime but not at runtime
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103
Index: components/fpcunit/Makefile.fpc
===
--- components/fpcunit/Makefile.fpc	(revision 8836)
+++ components/fpcunit/Makefile.fpc	(working copy)
@@ -7,7 +7,7 @@
 [compiler]
 unittargetdir=lib/$(CPU_TARGET)-$(OS_TARGET)
 unitdir=../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/
-options=-dLCL -dLCLgtk -S2 -gl
+options=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 
 [target]
 units=fpcunittestrunner.pas
@@ -18,6 +18,16 @@
   $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) \
   $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) \
   $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
+[prerules]
+# LCL Platform
+ifndef LCL_PLATFORM
+ifeq ($(OS_TARGET),win32)
+LCL_PLATFORM=win32
+else
+LCL_PLATFORM=gtk
+endif
+endif
+export LCL_PLATFORM
 
 [rules]
 .PHONY: cleartarget all
Index: components/fpcunit/Makefile
===
--- components/fpcunit/Makefile	(revision 8836)
+++ components/fpcunit/Makefile	(working copy)
@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/01/19]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/12/07]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
@@ -231,6 +231,14 @@
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 override PACKAGE_NAME=fpcunittestrunner
 override PACKAGE_VERSION=0.1
+ifndef LCL_PLATFORM
+ifeq ($(OS_TARGET),win32)
+LCL_PLATFORM=win32
+else
+LCL_PLATFORM=gtk
+endif
+endif
+export LCL_PLATFORM
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_UNITS+=fpcunittestrunner.pas
 endif
@@ -454,115 +462,115 @@
 override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
 endif
 ifeq ($(FULL_TARGET),i386-linux)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override COMPILER_OPTIONS+=-dLCL -dLCLgtk -S2 -gl
+override COMPILER_OPTIONS+=-dLCL -dLCL

[lazarus] GTK2 SetFont Patch - final (for now)

2006-02-27 Thread A.J. Venter
Right then, I tested this a bit and it seems to work pretty well unless I am 
still missing something, this version ALSO includes font.color support.

As a whole this should probably ALL be considered experimental code but it 
(probably) won't crash your apps.
At least I believe it provides a good base from which it can now be improved 
as any special cases reveal themselves and if any bugs are reported I will do 
my best to help fix them.

For now though, that's three patches in one night so I think I tortured 
everyone's mailboxes quite enough :p

Ciao
A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103
Index: lcl/interfaces/gtk/gtkwscontrols.pp
===
--- lcl/interfaces/gtk/gtkwscontrols.pp	(revision 8836)
+++ lcl/interfaces/gtk/gtkwscontrols.pp	(working copy)
@@ -30,7 +30,7 @@
 
 uses
   {$IFDEF GTK2}
-  Gtk2, Glib2, Gdk2,
+  Gtk2, Glib2, Gdk2,Pango,
   {$ELSE}
   Gtk, Glib, Gdk,
   {$ENDIF}
@@ -392,6 +392,14 @@
   const AFont: TFont);
 var
   Widget: PGtkWidget;
+{$IFDEF Gtk2}
+  PangoDescStr,DescOpts : String;
+  NewFontDescription : PPangoFontDescription;
+  Size : Integer;
+  Name : String;
+  xfg: TGDKColor;
+  State : Longint;
+{$ENDIF}
 begin
   if not AWinControl.HandleAllocated then exit;
   Widget:=pGtkWidget(AWinControl.handle);
@@ -399,13 +407,59 @@
 exit;
 
   if AFont.IsDefault then exit;
+{$IFDEF Gtk}
   DebugLn('TGtkWSWinControl.SetFont ',DbgSName(AWinControl));
   GtkWidgetSet.SetWidgetFont(Widget,Afont);
   GtkWidgetSet.SetWidgetColor(Widget,AWinControl.font.color, clNone,
   [GTK_STATE_NORMAL,GTK_STATE_ACTIVE,
GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
+{$ENDIF}
+{$IFDEF Gtk2}
+
+  If Afont.IsDefault then Exit;
+
+ If AFont.Size = 0 then
+ 	Size := 10
+ else
+   Size := AFont.Size;
+
+ if (length(AFont.Name) = 0) or
+(upperCase(AFont.Name) = 'DEFAULT') then
+	Name := 'Sans'
+ else
+ 	Name := AFont.Name;
+ DebugLn('TGtkWSWinControl.SetFont(GTK2) ',DbgSName(AWinControl));
+ PangoDescStr := Name;
+ DescOpts := '';
+  If FSBold in AFont.Style then
+		DescOpts := DescOpts + ' bold';
+  If FSItalic in AFont.Style then
+		DescOpts := DescOpts + ' italic';
+  If FSUnderline in AFont.Style then
+		DescOpts := DescOpts + ' underline';
+  If FSStrikeOut in AFont.Style then
+		DescOpts := DescOpts + ' strikethrough';
+
+   PangoDescStr := PangoDescStr+DescOpts+' '+intToStr(Size);
+//Pango does not appear to have a way to set the character set in the
+//font description but seems to default to UTF-8 this probably
+//requires some or other todo item.
+try
+NewFontDescription := PPangoFontDescription(PangoDescStr);
+NewFontDescription :=pango_font_description_from_string(PChar(PangoDescStr));
+ gtk_widget_modify_font(Widget,NewFontDescription);
+pango_font_description_free(NewFontDescription);
+//And now the font color
+	xfg:=AllocGDKColor(colorToRGB(AFont.Color));
+for State :=  GTK_STATE_NORMAL to GTK_STATE_SELECTED do
+	gtk_widget_modify_fg(Widget, State ,@xfg);
+except
+debugln('COULD NOT SET FONT');
 end;
 
+{$ENDIF}
+end;
+
 procedure TGtkWSWinControl.SetPos(const AWinControl: TWinControl;
   const ALeft, ATop: Integer);
 var
Index: lcl/interfaces/gtk2/gtk2int.pas
===
--- lcl/interfaces/gtk2/gtk2int.pas	(revision 8836)
+++ lcl/interfaces/gtk2/gtk2int.pas	(working copy)
@@ -54,6 +54,7 @@
 
   TGtk2WidgetSet = class(TGtkWidgetSet)
   protected
+procedure SetWidgetFont(const AWidget: PGTKWidget; const Afont: tFont);
 procedure AppendText(Sender: TObject; Str: PChar);
 function CreateComponent(Sender : TObject): THandle; override;
 function GetText(Sender: TComponent; var Text: String): Boolean;
@@ -120,6 +121,7 @@
 property Sorted : boolean read FSorted write SetSorted;
 property Owner: TWinControl read FOwner;
   end;
+  
 
 {$IfDef GTK2_2}
 procedure gdk_display_get_pointer(display : PGdkDisplay; screen :PGdkScreen; x :Pgint; y : Pgint; mask : PGdkModifierType); cdecl; external gdklib;
Index: lcl/interfaces/gtk2/gtk2object.inc
===
--- lcl/interfaces/gtk2/gtk2object.inc	(revision 8836)
+++ lcl/interfaces/gtk2/gtk2object.inc	(working copy)
@@ -959,6 +959,69 @@
 
   Applies a Message to the sender
  --}
+
+Procedure TGTK2WidgetSet.SetWidgetFont(const AWidget: PGTKWidget; const Afont: tFont);
+Var 
+  PangoDescStr,DescOpts : String;
+  NewFontDescription : PPangoFontDescription;
+  Size : Integer;
+  Name : String;
+  xfg: TGDKColor;
+  State: Longint;
+Begin
+{$IFDEF GTK2}
+If Afont.IsDefault then Exit;
+
+ If AFont.Size = 0 then 
+ 	Size

Re: [lazarus] TListview sorting

2006-02-28 Thread A.J. Venter
On Tuesday 28 February 2006 12:45, Graeme Geldenhuys wrote:
 Hi AJ,

 I might be to late for you, but this is how I did my sorting in a
 TListview.  It doesn't need to clear the Listview while sorting.  You
 might need to reset the .Selected though.

 This code goes into the ColumnClick event of the TListview:

Thanks for this, though indeed it won´t help me now. Having USED a grid and 
seen the power of using cell-draw events to display rather than maintaining a 
list (instant speed increases all around - and BIG NOTICEABLE ones) I am 
certainly not going back, not while my program needs to handle an average of 
12000 entries per session.
That said, I haven´t studied your code in detail but the thought occurs to me 
that nearly every listview sort tutorial for delphi uses an assignment to the 
customsort event, just about nobody seems to use built-in sorts so perhaps 
the easiest way to get more compatible is simple to export the right 
properties from the LCL to ALLOW people to assign a customsort method - which 
would of course still have to be written by the user.
This won´t implement tlistview.sort (for which mind you, your code may be a 
good start if you feel like working out how to make it a patch) but it WILL 
allow all those customsort based projects to work on lazarus.

Thoughts ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] Somewhat OT: The massive db-less search

2006-02-28 Thread A.J. Venter
Right, the final missing feature of OpenBook is to be able to search for 
phrases INSIDE the books, now the logical way would be to just check each 
book and determine whether or not it contains a matching phrase...
except that there are 12000 of them.

For the author/title searching it´s easy, I have a prebuilt index of files 
matching them to these details and I JUST search the index, I cannot rely on 
any kind of SQL style datbase (except maybe SQLite or something else that can 
work without a server) since the program must be able to run from DVD.

So the question arises how best to do it, searching for a phrase in 12000 
books one by one will take FOREVER.
Ideally I need to somehow build a wordlist/phrase index and search that, 
something like what htt://dig does, but I need to pass the results back to my 
lazarus code in a format I can easilly map back to the index (so I can 
display author/title information with the results) the last part is easy if 
the indexing contains a filename, I can just look up the filename from the 
author/title index.

So my question is can anybody recommend a good tool for creating such a search 
index ? It should either create it as some kind of easilly parseable text 
format, or alternatively something like an sqlite database could work as 
well. I just reckoned before I test a hundred apps, I would ask if anybody 
has any suggestions on which to try first.

One crucial element is that OpenBook is multiplatform with both windows and 
linux versions so it´s vital that whatever method I use to do this search 
behind the scenes is ALSO multiplatform.

TIA
A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Somewhat OT: The massive db-less search

2006-02-28 Thread A.J. Venter
On Tuesday 28 February 2006 17:24, Vincent Snijders wrote:
 If java is an option for you:
 http://lucene.apache.org/java/docs/

 If not, maybe you can port it to fpc.

 We use this (the .NET port) at work to index all publications of Statistic
 Netherlands. Searching is fast.

Thanks, I am looking now, there is of course a nice catch most search engins 
do word-list indexing, which is FINE for web-pages, but NOT for searching 
12000 books as just about every search would match nearly every book - a book 
is MUCH more data than a web-page. So litterally the only in data search 
that would give more or less usefull results is full-sentence searches - e.g 
ALL the words you entered IN THE ORDER you entered them DIRECTLY juxtaposed - 
easier in one sence since a substring search will either find an exact match 
or none at all, but harder in that wordlist indexing simply will not work.

Looking at things like lucene and egothor it seems that they actually want to 
search the files themselves... all good and well except for a catch - all the 
files are gz compressed, openbook has on-demand decompression built-in - so 
users don't even need to know about it, the file just appears to open from a 
users PoV.

Now this is not to say that using the indexes from such a search index will 
not work - I can index on the uncompressed copy and then just use the data - 
but somehow I just don't see keyword based searching as being truly usefull 
here, the data is just too different. Most large document warehouses have 
fairly diverse data in each document, but this is a disk full of books - most 
of them fiction, in other words the data you are talking about here is 
several megabytes per file, highly repetitive (in computing terms) and not 
very diverse (again in computing terms). 
A character name will probably get you only a few books, but a search like 
Here's looking at you kid is supposed to get pretty much only cassablanca, 
not every book that ever used the words looking and kid (which are the ones 
in that phrase which typical keyword searches would consider uncommon).

Frankly I am ready to tell my boss it cannot be done, doing per-file searching 
on the DVD is likely to take a few DAYS per result, and I just don't think 
you can DO this kind of search from metadata.
Well maybe if I could stick wikiquotes in there and then compare the results 
to my available book list - of course wikiqoutes is about 20GB and needs a 
webserver etc. - so it cannot exactly run from a DVD.

Basically unless somebody already knows how to do this, I am happy to admit I 
am not smart enough to solve THIS one :)

A.J.
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] GTK2 SetFont Patch - final (for now)

2006-03-01 Thread A.J. Venter
On Wednesday 01 March 2006 10:36, Panagiotis Sidiropoulos wrote:
 Are all these changes available just by svn update and recompiling
 Lazarus or anything more is needed?

 Panagiotis
Yes, since Mattias applied the patches to the main tree.
At this stage I am waiting for more clarity on where Darek's GTK1 work is 
going before advancing mine so that the two can be kept in design sync.

Ciao
A.J.
PS. Darek, thanks for your note earlier, but my name is AJ not AI (though that 
might have been cool :p )
-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] The Latest IDE icons

2006-03-01 Thread A.J. Venter

 
  I vote to change them back to original ,too.Icons are too large and
  almost lay on each other (visually it's hard to find needed control on
  tab Standard or Additional) Some of them are good looking however.

 Whit the images itself I don't have a problem. They don't differ much
 from the original (its this thread which brought it to my attention).
 But indeed, I think the buttons might be somewhat bigger.

I like some of them, and dislike others myself but I LIKE the idea of a 
distinct lazarus icon set, some of the component buttons are too small though 
(or perhaps the icons are too big ?)

On a related noted, I have been thinking that it would be great to have a set 
of developer-icons which can be (optionally) installed with lazarus for use 
by lazarus programmers inside apps. 

Now I don't feel like starting from nothing, so my suggestion would be to take 
the icon set from kylix to get a LIST of what icons are shipped with delphi 
(but NOT use those - licensing) and then take some very good LGPL'd icon set 
(I love nuvola so it has my vote), take the 16x16 icons from that and do a 
set of xpm/ico conversions selecting a replacement for everything on the 
kylix/delphi list.
The default location of this set could then be the default start directory for 
the IDE image-open dialog - making it just that much easier on somebody using 
it for the first time as they will be able to instantly find icons for their 
image-lists etc.

What do you all think about this ? I am happy to do the work but obviously I 
won't bother if nobody else thinks it's a good idea. Since it will be fairly 
static, it may not have to go into the SVN tree, perhaps it should be 
distributed as a separate zip/tarball - all off of these things are worth 
thinking about and discussing.

Ciao
A.J.

-- 
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Changing SynEdit - actions

2006-03-01 Thread A.J. Venter

  - Move all (all non-basic at least) editor commands to a separate
  unit and implement each command on a separate method or class. I'm
  inclined to make them TAction descendants to unify shortcut handling,
  but I'm not set yet...

 What would we gain?

Reuse ?
In theory (depending on how that unit is implemented).
It should be designed to work on any stringlist (which is what I believe the 
underlying data-set in synedit is), so it can update a synedit, or a memo or 
whatever and can be used for other components or heck if called from code 
directly to do easy advanced stringset parsing. 
Imagine if we could tell a programmer that the stringset he is trying to 
modify in a certain way before displaying - well he can access the search|
replace menu's own command from his code with all it's features|power.
Right now most string parsing seems to be handled by pos, copy and delete - 
which works but why should people need to write the same code over and over  
when lazarus already contains it ? 

A.J.
Some might notice I am highly in favour of lazarus having MORE than delphi 
ever did - to make delphi users SWOON over it :)
-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] The Latest IDE icons

2006-03-01 Thread A.J. Venter
On Wednesday 01 March 2006 11:29, Andrew Higgs wrote:
 A.J. Venter wrote:

 snip

  What do you all think about this ? I am happy to do the work but
  obviously I won't bother if nobody else thinks it's a good idea. Since it
  will be fairly static, it may not have to go into the SVN tree, perhaps
  it should be distributed as a separate zip/tarball - all off of these
  things are worth thinking about and discussing.
 
  Ciao
  A.J.

 I like the idea. Let me know if there is anyway I can assist.

Well then, why not split the job evenly ? I'll do the xpm's, and you can do 
the ICO version ? The first part is going to be selecting the right icon 
replacements, I have no doubt I will on occasion be stuck between choices, at 
those times I would like to put it up for a vote if the list admins have no 
objections to me sending the ones I am looking at an asking which the users 
would prefer.

A.J.

-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Changing SynEdit - actions

2006-03-01 Thread A.J. Venter

  Right now most string parsing seems to be handled by pos, copy and delete
  -  which works but why should people need to write the same code over and
  over   when lazarus already contains it ?

 The same reason, why there are so many databases.

Touché, anyway your explanations did give me a lot more clarity on the nature 
of the underlying code, and I can see that making it generic would be a lot 
of work, perhaps not worth it unless somebody has an itch.

Ciao
A.J. 
-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Somewhat OT: The massive db-less search

2006-03-01 Thread A.J. Venter
Actually I found a nicer solution :)
I integrated with wikiquote.org (which was something I came up with while 
discussing the problem with you guys).
Selecting a phrase search hides the  book and submits the search to wikiquote, 
grabs the results, preparses them and displays the list of matches in an 
iphtml panel, clicking on any of the links in the list, then submits the link 
value as a search back into my indexing in BOTH artist and title fields.

So if you search for ¨Wherefore art though romeo¨ one of the results will be 
¨William Shakespear¨, clicking the link brings up the entry ¨Shakespear´s 
first folio¨ by William Shakespear from my list, which happens to contain 
among it´s 35 plays ¨Romeo and Juliet¨.

True it requires an internet connection but what it doesn´t require is any 
real CPU/disk usage - and it has the power of an index maintained by 
thousands of volunteers :), these days programs being able to integrate 
cleanly with online information sources is considdered a good thing right ? 
it was for this that I needed the connectivity check, so that I could disable 
the quote-search checkbox if there was no internet.

Ciao
A.J.
On Tuesday 28 February 2006 17:51, William Cairns wrote:
 Have you considered a two pass approach?

 ie Do the first regular search using Looking and Kid to get a list of
 the books that might have the full phrase in it. Then only decompress and
 search in those books for the full phrase.

 -Original Message-
 From: A.J. Venter [mailto:[EMAIL PROTECTED]
 Sent: 28 February 2006 17:44 PM
 To: lazarus@miraclec.com
 Subject: Re: [lazarus] Somewhat OT: The massive db-less search

 On Tuesday 28 February 2006 17:24, Vincent Snijders wrote:
  If java is an option for you:
  http://lucene.apache.org/java/docs/
 
  If not, maybe you can port it to fpc.
 
  We use this (the .NET port) at work to index all publications of
  Statistic Netherlands. Searching is fast.

 Thanks, I am looking now, there is of course a nice catch most search
 engins do word-list indexing, which is FINE for web-pages, but NOT for
 searching 12000 books as just about every search would match nearly every
 book - a book is MUCH more data than a web-page. So litterally the only in
 data search that would give more or less usefull results is full-sentence
 searches - e.g ALL the words you entered IN THE ORDER you entered them
 DIRECTLY juxtaposed - easier in one sence since a substring search will
 either find an exact match or none at all, but harder in that wordlist
 indexing simply will not work.

 Looking at things like lucene and egothor it seems that they actually want
 to search the files themselves... all good and well except for a catch -
 all the files are gz compressed, openbook has on-demand decompression
 built-in - so users don't even need to know about it, the file just appears
 to open from a users PoV.

 Now this is not to say that using the indexes from such a search index will
 not work - I can index on the uncompressed copy and then just use the data
 - but somehow I just don't see keyword based searching as being truly
 usefull here, the data is just too different. Most large document
 warehouses have fairly diverse data in each document, but this is a disk
 full of books - most of them fiction, in other words the data you are
 talking about here is several megabytes per file, highly repetitive (in
 computing terms) and not very diverse (again in computing terms).
 A character name will probably get you only a few books, but a search like
 Here's looking at you kid is supposed to get pretty much only
 cassablanca, not every book that ever used the words looking and kid (which
 are the ones in that phrase which typical keyword searches would consider
 uncommon).

 Frankly I am ready to tell my boss it cannot be done, doing per-file
 searching on the DVD is likely to take a few DAYS per result, and I just
 don't think you can DO this kind of search from metadata.
 Well maybe if I could stick wikiquotes in there and then compare the
 results to my available book list - of course wikiqoutes is about 20GB and
 needs a webserver etc. - so it cannot exactly run from a DVD.

 Basically unless somebody already knows how to do this, I am happy to admit
 I am not smart enough to solve THIS one :)

 A.J.

-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] GTK2 SetFont Patch - final (for now)

2006-03-01 Thread A.J. Venter

 Yes, since Mattias applied the patches to the main tree.
 At this stage I am waiting for more clarity on where Darek's GTK1 work is
 going before advancing mine so that the two can be kept in design sync.

 What I can do for You now.

Heh, well what would actually be very usefull is if you send me a list of what 
you added for which widgets which were not handled by the existing code - 
then I will have a good idea where to start implementing for mine, I already 
started picking up some special cases, notably that right now setcolor works 
for tpanel but setfont does not.

SInce gtk1 and gtk2 are so similiar I think it is a good thing if we keep our 
work synchronized because a lot of what one of us does will influence how the 
other should do things.
What I think might be wise as well is if we start a wiki page (when the wiki 
is back) documenting which widgets we change and how - this will be very 
usefull to those working on other widget sets, e.g. the QT and Carbon set 
guys. While it won´t apply 100% to their sets if we can point out 80% of the 
special cases for fonts and colours, they only have to do 20% as much work :)

What do you think ?

A.J.
-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Repository access via the SVN protocol

2006-03-04 Thread A.J. Venter

 
  Our german FTP machine was compromised recently (that is why the wiki
  is down). The main server has also been compromised some time ago.
  Since then, I am reluctant to open too much ports.
 
  In reality, the problem is with your ISP, namely that they don't
  seem to support all WebDAV commands in their proxy.
 
  What about letting apache listening to a second port ?
 
  What good would that do ? Fooling the proxy ?

 Yes, mostly transparent proxies are configured for known http ports like
 80, 1080 and 8080 and wont affect other ports.

Hiya Graem
Sorry I didn´t respond earlier, I was a bit tied up  with getting my new bike 
registered :)
Anyway, just for the record, I have had no problems accessing either http or 
svn based subversion sites from sentech, so I presume either your own ISP or 
telkom did something amazingly stupid on their transparent proxy. 
Of course we do not live in the kind of free market system where if a company 
buggers up like that they better appologise and fix it before they lose a 
customer, we live in a ¨internet-consumer¨ system with a single government 
sanctioned monopoly provider who doesn´t care two hoots about their customers 
OR their staff (what kind of a company records multiple-bilions in profit and 
then fires 7000 employees in the same month ? A very unethical one).

Oh well, moaning about it won´t fix it, I just wanted to let you know that 
sentech is coming through clean.

Ciao
A.J.

-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Object pascal a Modern Language

2006-03-04 Thread A.J. Venter

 
  python is a very nice language.
  Why don't you just write the speed critical parts in C or C++.
  That's how everyone does it in python.

 Showing only that python isn't up to the task.
 Just like all these other interpreted languages: .NET, Java...

 It's cheating, and they all do it: falling back to compiled
 languaged. My message to the designers of these languages:
 Quit fooling around, and do things right from the start.

This does bring up an interesting point, why is it that more and more 
languages are becoming interpreted or bytecompiled ? I mean, surely the 
python designers could have written platform level compilers for no more 
difficulty than to write bytecompilers ?
Heck they even got jython - compiling to the java vm so they must have had the 
option.

Instead it offers the choices of bytecompiled or scripted.
Why is source portability not enough ? Why sacrifice so much speed and power 
to get binary compatibility (or at least cheat so it looks like that) ?
Of course that is not the only power that gets lost, memory management, 
pointers - there is so much these approaches sacrifices, now I know their 
designers love to say things like if you need pointers you are doing it 
wrong but in my mind that is a cop-out to avoid dealing with the fact that 
they make it impossible for programmers to use a truly powerful construct 
that can do some pretty amazing things. 
The simple truth is that even java's pseudo implementations of things like 
hash tables to get around the fact that in other languages those are done 
with pointers aren't good - I have USED java's hash table interface, it's 
horrid !

As I told a SUN employee a few days ago I will stick with having a truly 
powerful source-portable fully object oriented language that doesn't practise 
bondage-and-discipline on style for as long as such languages exist - in 
short, I will use and promote lazarus - not java

As an aside, I remain adamant that anybody who writes a free software/open 
source program in Java is being foolish. What is the POINT of a free software 
program that REQUIRES a non-free program just to RUN ?

Ciao
A.J.
-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Object pascal a Modern Language

2006-03-04 Thread A.J. Venter
 less power. It's always like that. The language of a human (and maths)
 is just so much more advanced than any computer language, it depresses
 me at times. (Assembly language is so primitive that we all stopped
 talking it by now, except when we absolutely must do it. But it sure is
 flexible, like an atom - you can use tons of them to build a copy of
 the earth, given you have a few billion years time and way too much
 patience for your own good :))

This is a nice argument but it's highly subjective, I find OP to be the 
computer language CLOSEST to human language, python and java both inherrited 
too much ascii art from C++ and don't get me STARTED on perl !

One of the things I love about OP (a compiled language) is that it uses mostly 
WORDS to say things, not symbols, true it's slightly more typing  - but it is 
so much more readable. 

I always tell my trainee's If I NEED comments to read your code - it is badly 
written. Of course I also make it absolutely clear that any program of more 
than 100 lines which doesn't have comments is pretty much guaranteed to 
ensure they won't get a permanent position with me, but comments should be 
there to add clarity NOT to tell you what the code DOES ! That should be 
obvious just from reading the code.

This isn't possible in most languages, in OP it's the default - that is why I 
think it's such a brilliantly designed language, and the fact is this is 
something Pascal has boasted since Wirth invented the first version of it. 

Pascal is probably the only language you can read (large sections of) aloud 
without stuttering. In other words, by your argument those languages have all 
failed at exactly the supposed REASON they are interpreted/bytecompiled in 
the first place. 

Like I said, it's way too subjective an argument. Now don't get me wrong, I 
actually rather like python, it has a nice design (although the whole 
whitespace has meaning thing annoys me a bit) and a fairly decent syntax but 
the simple reality is that I write code which will end up running on thin 
clients - that means if a computer slows down to any noticeable degree when 
running 50 copies of the program at once -it's not good enough, and that 
rules out python for anything complex. 
Lazarus works beautifully, I have the language that I like for most work, I 
can quickly design my GUI's in a RAD environment and the programs run FAST.

In the end, Java has spent ten years telling programmers that computers are 
now so fast that customers don't care about speed anymore, and in ten years 
computers still haven't gotten that fast and frankly they never will because 
as computers get faster customers will always expect software to get faster 
at the same rate (and customers being customers they will expect it to be 
just as fast on a PII). In the real world, a program that runs slowly and 
uses up a lot of resources annoys customers and they find another program. 

Throw in the realities of Africa, and you end up utilising things like thin 
clients so that those PII's or sometimes even 486's can run modern day apps. 
Of course they are never quite as fast as on a P4 but they look as fast to 
users which is good enough -at least for compiled programs which do not abuse 
all the available resources in the system but use only what they need leaving 
the rest for the other users.

In the end, the choice of a language is personal and not the least of your 
concerns should be what language does most of the people on this project 
know the best, but discounting OP because of what it wasn't in the 80's 
is ... well uninformed silliness.

A.J.
-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] setColor part 3

2006-03-04 Thread A.J. Venter

 gtk does the right thing by letting the programmer register style
 properties for a widget class. These names can then be used in themes
 and gtk will assign the theme color to the style property of the widgets
 of that class on runtime.
 
 I know that it usually depends on the target audience whether it's ok to
 take shortcuts like hardcoding colors (if your program is to be used by
 an internal group of 5 people, new people never enter, and none of them
 has color blindness, sure, hardcode red all you like). _But_ when
 designing a framework, that is the wrong way to take because they affect
 all the users there are.

What you are saying is correct, but not absolutely so. There are exceptions to 
every rule and the fact is programmers MUST have the capacity to sometimes 
enforce certain look and feel changes regardless of themes because themes are 
always generic (they are meant to apply to all apps) and sometimes a program 
is doing something which is simply specific to that program and the 
programmer needs a way of visually explaining a concept to users which simply 
does not exist in any theming system.
Take tappytux for example (the program which was the reason why I started the 
gtk2 font setting patches). Number one requested feature from users was: make 
the text entry bar at the bottom HUGE.

This was not MY choice, it was THEIR choice. This was not something that could 
be done for EVERY tedit in the program, but it HAD to be done for THAT tedit  
- because the nature of the program was such that, that entry bar had to be 
really big and accentuated. 
Why ? Because the program is for children, and it's a game - and people who 
only learned to read a month ago needs to be able to read what they type in 
there at a single glance.
The rest of the program they have TIME to spell out letters, if they have to 
do it there they will never learn not to have to (at least not from the 
program which is supposed to have been written to help teach them this) 
because they will simply go game over before they finish the first word.

See what I am getting at ? It's partially intended audience but it's also 
purpose of the program, sometimes a programmer needs to be able to enforce 
some things in the look and feel department.
Finally there is the simple reality that despite the lack of credit popular 
culture gives us in this regard nearly all programmers are highly creative 
people. We LIKE to design interfaces and we like to be a little bit artistic 
when we do, and there is nothing wrong with that. Since we are the creators, 
we should be able to design something which is visually pleasing to us ?

I am not saying we should force users to use bright-red buttons (and I know 
that green-red as distinguishing features is a horrible thing to do to users 
since about 8% of men cannot distinguish them), but I am saying that we 
SHOULD be able to sometimes say This is the main headline part of my main 
screen - I would really like it if it was in Mincho Gothic font in blue 
letters on a cream colored button -because it is not SUPPOSED to be the same 
as the other buttons - and that I believe is entirely a good thing, and 
something I encourage in my trainee's.
Programmer designs should never detract from usability, but we should still be 
able to employ a little bit of creativity in interface design - the job of 
interface design is to take an abstract computing concept of some sort and 
create a visual analogy that allows non-computer experts to understand what 
they program does for them and how to achieve their goals with it. This IS a 
creative process and ingenuity can make all the difference here, especially 
with custom apps which are often the first to design for a certain concept. 
To imagine that any theme can be broad enough to handle ALL the problems any 
program will ever be asked to solve and still be usable as a theme is 
downright ridiculous.
The default should always be to follow the theme, the programmer should think 
five or six times before overriding it - but when he does, it must be assumed 
that he had a good reason and his changes should be honoured.

Ciao
A.J.
-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] setColor part 3

2006-03-04 Thread A.J. Venter

  The default should always be to follow the theme, the programmer should
  think five or six times before overriding it - but when he does, it must
  be assumed that he had a good reason and his changes should be honoured.

 Exactly.

Let me try to explain what I mean with an EXTREME example.
Say you are coding the control system for a nuclear power station. Now 99% of 
your screen is showing the current values for things and with some sliders 
the operators can adjust some of the equipment settings to ensure that 
everything remains normal.

For almost all times this is ALL there is to it. But there on one side is a 
few critical values, these ones won't just be changed by adjusting one thing, 
if they are outside tolerance values then that means a trained expert will 
need to adjust probably 80% of those sliders to very specific settings to 
deal with what is in fact an emergency.

So when one of those goes out of tolerable range you start by activating every 
alarm in the building, syrens howling, strobe lights flashing the works. But 
on screen you do NOT want everything highlighted. What you DO want is for the 
area around the specific value that triggered the problem to start cycling 
through red-green-blue-orange-purple and some more colours at a fairly high 
rate so the operator your alarm woke up will INSTANTLY see which value is out 
of range and can start fixing it immediately.
You don't want to pop up a dialog - clicking ok means it takes longer before 
he starts adjusting the parameters, but you MUST highlight THAT specific 
element in a way that should NEVER happen otherwise.

The element may be a TEdit on a tgroupbox. Now if an emergency exists and you 
start colour-flashing the tgroupbox to draw attention to the RIGHT tedit but 
a theme overrides your colour calls so it doesn't flash and the whole town is 
flattened before the operator finds the right value (he cannot fix the 
problem until he knows WHAT the problem is) - well the whole theory just went 
up in smoke (as did the town).

In a non computerized nuclear power station, a big LED would have flashed 
below the dial with the out of sync value, in a computerized version you HAVE 
to find a way of getting exactly the same kind of notification and theme must 
not prevent you from doing it, especially since computerising has so many 
other usefull advantages (a computer could solve simpler cases itself, like 
automatically increasing cooling if the temperature rises by a few degrees)  
in other words, a computerized interface is a good idea - but it MUST be able 
to override the theme when needed.

Yes this is probably the most extreme example there is but it is a very real 
one, and just because most of us are not coding nuclear reactor controls 
doesn't  mean that our reasons for occasionally having to FORCE colors or 
fonts are not good ones.

A.J.
-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] button icons for lazarus

2006-03-04 Thread A.J. Venter
After some positive feedback on the suggestion last week, I did the work and 
created a full set of button icons for lazarus. This set provides a 
replacement for everything in the standard delphi buttons directory under 
images. 

Right now, only xpm's exist. Most of the icons were taken from the Nuvola set 
for KDE (lgpl license) but a few came from CrystalSVG as well. Where I could 
not find a suitable replacement, I made it myself. Overall they are as 
consistent as I could get them and should hopefully help give lazarus apps a 
more consistent look and feel. Most importantly though I hope they will save 
lazarus programmers some time by providing prebuilt icons for most common 
button-tasks so that nobody has to sit and create/find icons first.

The icon names were taken directly from their delphi counterparts for 
familiarity reasons (of course it also made it a lot easier for me to see 
what I had done yet and what was waiting).

Andrew Higgs has offered to do ico format versions of them, I personally see 
no point in redoing the masked bitmap format that delphi used though I am 
open to the idea if somebody can give a good reason and will volunteer for 
the labour. However, I do think that before Andrew starts to do ico's I would 
like everyone interested to take a look at the icons and make suggestions for 
improvements, if you send me a better version of one of them, I will happily 
replace it.

The bit which would make me very happy if guys on top were so inclined would 
be to see it included in the main lazarus tree eventually (based on it's 
delphi counterpart it should go under $LAZARUSDIR/images/buttons) but that 
should wait until after people had a chance to at least comment on the 
current set.

I am wearing my asbestos undies so if you think I did a horrible job, you are 
welcome to tell me :)

The icons are in my subversion server and can be checked out with:
svn co svn://silentcoder.co.za/lazarus/buttons/

Ciao
A.J.
PS. Andrew, mail me with the username and password  you would like, and I will 
give you write access to the tree.

-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


[lazarus] TRunInThread - Progress, but new problem

2006-03-04 Thread A.J. Venter
Well since my last mail on this a few weeks ago, I have made quite a bit of 
progress in my attempts to create a component that will allow me to call a 
tprocess in a thread while retrieving the output live.

The structure I have no compiles, and can be placed on a form - it is all but 
right. The only trouble is - when I call the run method, it throws an access 
violation, the stack trace places it at line 76 (the line where I call 
FProcessThread.resume), I did a check and the first line of the execute 
method does not ever get executed.

At this stage the whole thing consists of two units. 
processthread.pas implements the TprocessThread class which is just a simple 
TThread descendent which runs a command.
TRunInThread is a TComponent descendent which encapsulates TProcessThread with 
a component, setting up an instantiation of it, executing it, storing and 
updating the output etc. 
In theory it should all work so I really do not know why it's throwing a 
trace, perhaps somebody else can tell me what to change ?

I attach both the units for your viewing pleasure.

-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103
unit processthread;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils,process;

Type
TProcessThread = class(tthread)
   protected
 procedure Execute; override;
   public
 fcommand : String;
 Constructor Create(isSuspended : boolean);
   end;

Var
   MemStream :TMemoryStream;
   Running:Boolean;

implementation

constructor TProcessThread.Create(isSuspended : boolean);
 begin
   MemStream := TMemoryStream.Create;
   inherited Create(isSuspended);
 end;

procedure TProcessThread.Execute;
const
  READ_BYTES = 2048;

Var
 Process :Tprocess;
  n: LongInt;
  BytesRead: LongInt;
begin
Process := TProcess.create(nil);;
 Process.CommandLine :=  Fcommand;
Running := True;


 {Actually run the thing and catch the output}
  BytesRead := 0;

Process.Options := [poUsePipes,poNoConsole];

  Process.Execute;

  while Process.Running do
  begin
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);

// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n  0
then begin
  Inc(BytesRead, n);
end
else begin
  // no data, wait 100 ms
  Sleep(100);
end;
  end;
  // read last part
  repeat
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);
// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n  0
then begin
  Inc(BytesRead, n);
end;
  until n = 0;
  MemStream.SetSize(BytesRead);
 Process.Free;
 Running := False;
end;

end.

unit RunInThread;

{$mode objfpc}{$H+}

interface

uses
  LResources,Classes, SysUtils,ProcessThread;

Type
TNewOutPutEvent = procedure(Sender: TObject;NewOutPut:TStringList) of object;
  
TRunInThread = Class(TComponent)
private
FOutPut : TStringList;
FNewOutPut :TStringlist;
FProcessThread : TProcessThread;
FCommand : String;
FRunning : Boolean;
FOnNewOuput : TNewOutPutEvent;
FOnDone : TNotifyEvent;
FLastSize : Integer;
FLastMSize : Integer;
procedure GetOutPut;
destructor destroy; override;
public
constructor Create(AOwner: TComponent);
procedure run;
published
property Command : String read FCommand write Fcommand;
property OutPut: TStringLIst read FOutput;
property Running: Boolean read FRunning;
property OnNewOutput : TNewOutPutEvent read FOnNewOuput write FOnNewOuput;
property OnDone : TNotifyEvent read FOnDone Write FOnDone;
end;

procedure Register;

implementation
procedure Register;
begin
  RegisterComponents('OLPack',[TRunInThread]);
end;

Constructor TRunInThread.Create(AOwner: TComponent);
Begin
  FLastSize := 0;
  FLastMSize := 0;
  FOutPut := TStringList.Create;
  FNewOutPut := TStringList.Create;
   FProcessThread := TProcessThread.Create(false);
   FProcessThread.FCommand := FCommand;
if Assigned(FProcessThread.FatalException) then
  raise FProcessThread.FatalException;
inherited create(AOwner);
end;

Destructor TRunInThread.Destroy;
Begin
 FProcessThread.Suspend;
 FOutPut.Free;
 FNewOutPut.Free;
 FProcessThread.Terminate;
 inherited destroy;
end;


Procedure TRunInThread.GetOutPut;
Begin
   FOutPut.LoadFromStream(MemStream);
end;

procedure TRunInThread.Run;
Var I : Integer;
Begin
  FProcessThread.Resume;
  FRunning := True;
  While Running do
  Begin
 If MemStream.Size  FLastMSize then
begin
 FLastMSize := MemStream.Size;
 GetOutPut

Re: [lazarus] TRunInThread - Progress, but new problem

2006-03-04 Thread A.J. Venter
On Sunday 05 March 2006 08:43, A.J. Venter wrote:
 Well since my last mail on this a few weeks ago, I have made quite a bit of
 progress in my attempts to create a component that will allow me to call a
 tprocess in a thread while retrieving the output live.

 The structure I have no compiles, and can be placed on a form - it is all
 but right. The only trouble is - when I call the run method, it throws an
 access violation, the stack trace places it at line 76 (the line where I
 call FProcessThread.resume), I did a check and the first line of the
 execute method does not ever get executed.

Mmmm, I think I know now why this is happening, though now I have even LESS of 
an idea how to prevent it.
I instantiated TProcessThread directly in a test program (obviously this left 
me with no events or such but I was just trying to see if it worked) when I 
call TProcessThread.Create the program dies with error 232 complaining that 
there isn't a thread driver.
I checked the lpr, it calls cthreads. I checked lazarus.pp - that too calls 
cthreads, the only thing I can imagine is that I must somehow call cthreads 
in olpack, putting it in olpack.lpk doesn't work - lazarus recreates the file 
on compile/save apparently, putting it in runinthread.pas doesn't  work 
(probably because it's not early enough in the uses clause) - leaving me 
unable to determine where I SHOULD add it - or is this the IDE telling me 
that what I am trying to do is simply not possible ?

TIA
A.J.
-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] setColor part 3

2006-03-05 Thread A.J. Venter

 It's much simpler to implement one custom drawing function for a control,
 then to map to various themed widgetsets. The LCL took the difficult and
 more complex approach. Other people can contribute custom drawn controls. I
 wonder, why there is not already a package providing some custom drawn
 controls as there are so many for Delphi.
Well most of my visual components are actually custom drawn since they are 
designed to implement stuff that GTK doesn't normally do. Where themes fall 
short is in going one level up as it were. A quick google will find you at 
least twenty delphi components for doing more advanced pop-up hints with for 
example, depending on what you are looking for (everything from bubble-shaped 
to extensive html with image support is available) - THAT is where custom 
drawing becomes usefull, for adding that which gives your program an edge. 
Sure you don't NEED bubble-shaped pop-ups but they are more pleasing to users 
than square lines, and in fact they are becoming the default in several 
development environments (on windows anyway). 
As far as I can tell, there is no way to implement this with a theme - you 
need some form of custom drawing to do it, and I don't think it can be said 
that this in any way detracts from usability.
Several usability studies have come to the same conclusion, the universal look 
and feel is a myth - icons and colours only have meaning in the culture from 
which they originate - in other cultures they could mean completely different 
things or more commonly nothing at all - the core thing a programmer MUST do 
for usability is be consistent -always use the SAME file open icon, so users 
can recognise it even if it DOESN'T mean anything to them. 
The second most important thing is to ensure that your interface makes the 
purpose of every element obvious right from the start, the more obvious you 
can make things the easier it is to get the program. 
The third rule is - make it look pretty.

Rule 1 says - uses themeing almost all the time.
Rules 2 and 3 says - override the theme if you have to.

Mind you lazarus does not at present provide a clean way of SETTING theme 
style properties, and I think it will be very hard to add since the nature of 
this will be platform independent (I highly doubt that the same themeing 
structure would work on windows that works on GTK and even between GTK1 and 
GTK2 there are huge differences in the theme files).
What would be good is if we can create a set of generic theme-style specifiers 
for the LCL (much like we translated widgets) which are added as ADDITIONAL 
properties, not replacing the delphi properties but being added as extras. 
This way you can set at least those elements which are common to all 
platforms in the IDE and it will follow a theme file on how to actually 
implement them, but when there is a good reason, you use the delphi style 
properties to override the them.
A side effect is that if it can also translate to CSS properties it would be a 
very nice tool one day when CGI-from-the-IDE starts to become visual :)

  When I say : live its not so simple, I think: nobody know all aspect and
  environment of every program. One tools never be enough good to use in
  any case.

 Sure, but we try. :)
Lol, that is why there isn't one programming language to rule them all :) but 
OP comes pretty close. 

-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] TRunInThread - Progress, but new problem

2006-03-05 Thread A.J. Venter

  I checked the lpr, it calls cthreads. I checked lazarus.pp - that too
  calls cthreads, the only thing I can imagine is that I must somehow call
  cthreads in olpack, putting it in olpack.lpk doesn't work - lazarus
  recreates the file on compile/save apparently, putting it in
  runinthread.pas doesn't  work (probably because it's not early enough in
  the uses clause) - leaving me unable to determine where I SHOULD add it -
  or is this the IDE telling me that what I am trying to do is simply not
  possible ?

 You should add it in the program file (.lpr) of your test program.
 As the _first_ unit (possibly after cmem, if you use that too).
It IS the first unit in the lpr :(
Could it be that it somehow just doesn't get compiled intoto the component  ?
Has anybody ever DONE a threaded component ?

A.J.
-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] button icons for lazarus

2006-03-05 Thread A.J. Venter

  
   Well I wasn't trying to extend the IDE, but to give a tool for USERS of
   the IDE, specifically to give replacements for the standard icons that
   delphi shipped with. These are not really meant for use INSIDE the IDE,
   but are meant to be available to people coding WITH the IDE.
   For compatibility I replaced specifically the icons that are in delphi
   (well Kylix OE actually), with the same names, and the same sizes
   (delphi's icon's are ALL 16x16)
 
  That is not completely correct: The component palette icons are 24x24,
  this is even a requirement which is documented.

 23x23
 Actually ideintf/formeditingintf.pas defines 25x25. Minus the border of at
 least 1 gives 23x23.
 Where is 24x24 documented?
Well like I said I was never TRYING to do buttons for use by the IDE or for 
the component pallette, I was doing icons for use by programs, e.g. for 
toolbars and menu's - basically to provide a set of instant access default 
buttons to put in timagelists.
Now having said that, there is no reason the same icons cannot be done at ANY 
size, or based on ANY icon set, but since there wasn't anything at ALL for 
this, I asked and people said it would be a good idea so I went ahead and 
pulled an allnighter and did it.
Now perhaps what is coming out of this is that we should in fact expand the 
set and possibly even start a full-scale subproject doing lazarus icons both 
for use by lazarus programs and for the IDE itself in all the appropriate 
sizes and styles ?

  The icons delivered with Delphi are 16x16, but that is because it is
  essentially still the same set of icons as delivered with Borland Pascal
  for windows 3.1
While this wouldn't surprize me at all there is more to it, considdering what 
these icons were typically meant for - 16x16 is STILL the standard size, I'm 
sitting in front of KDE right now and all the toolbar icons are 16x16 as are 
all the icons in menu's - because bigger than that and it would dwarve the 
text that goes next to it. 
While there may be good reasons for providing larger icons as well - for the 
goal I was trying to achieve, 16x16 remains the standard size on every 
desktop I know about and is likely to remain so for a long time yet.
 
  GUI and graphics requirements have increased since 3.1, so I would opt
  for a standard size of 22x22 ?
Possibly, though yet again - we are not talking about stuff to put on your 
Tglyphbuttons here but about things to put on toolbars and inside TMainMenu's 
- 16x16 as an available option at least must be considered, unless we will 
code automatic scaling into all the onpaints...
Basically what I am trying to do is to complete lazarus a little - by adding 
some of the things delphi users have come to expect, like a readily available 
set of standard icons they can assign to typical tasks like File|Open.

Ciao
A.J.


-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] button icons for lazarus

2006-03-05 Thread A.J. Venter
On Sunday 05 March 2006 14:13, Darius Blaszijk wrote:
  We should have fixed sizes (16x16, 24x24, etc.) not scaled sizes which
  are looking ugly.

 It makes no sense to use more than two sizes inside an app.

 16x16  - menuitems, treeviewitems, listviewitems, small toolbars buttons
 22x22 or 24x24 - large toolbar buttons

I'm with you on that one, but I spent about 5 hours doing these (quite a lot 
considering most of them were just conversions) the hard part was finding all 
the names, so I am not doing more today, but I reckon adding a 22x22 set 
should be faster. I want to do it the right way though - recreating them from 
the original SVG scaled images, not scaling the existing xpm's which will 
just make them ugly.

A.J.

-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: {SPAM?} Re: [lazarus] System Information

2006-03-05 Thread A.J. Venter
On Sunday 05 March 2006 22:29, Panagiotis Sidiropoulos wrote:
 I found Linux command hdparm at
 http://www.webmasterworld.com/forum40/957.htm. This command provides a
 part of information I need, as follows. Is it possible to retrieve this
 information from inside a Lazarus app but without root previledges?

You should be able to get almost all of it from /proc normal users have 
read-only privileges there, it's basically a case of reading files to get the 
information you want.

A.J.

-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Using MySQL

2006-03-06 Thread A.J. Venter
On Monday 06 March 2006 13:15, Andreas Berger wrote:
 A few years back I went to a trade show where I met a representative of
 MySQL. Since MySQL is not free for comercial applications I asked him if
 I could use Delphi (at the time) that supports MySQL to write an app
 that uses MySQL and distribute it. He answered: only if you supply the
 souce to the app as well. I then asked if I could distribute the app
 and let the client download and install MySQL seperatly. He said no
 since the component used by Delphi was GPL and therefore forced me to
 distribute my sourcecode anyway.

 My question: does anyone know how this issue stands with Lazarus?
Same rules, lazarus is lgpl but the mysql libraries it uses are GPL´d - you
don´t need anything from the lazarus guys to create a closed source mysql 
based app - but you are linking against a GPL´d library - and that requires 
the permission of the copyright holder - e.g. mysql inc.

So to put it another way, the catch is with libmysqlclient.so which is gpl´d 
and that means any app linked against it MUST be gpl´d as well, you need a 
commercial license from mysql if you want to write a non-gpl´d program using 
it. 
The lazarus mysql components are NOT affected since they do not link against 
the library - they merely translate the function names and then use an 
external call to implement them - your program which uses that 
unit/components however DOES get linked against it.

Only question is whether this means the lazarus IDE gets linked against 
libmysqlclient when the mysql support for the IDE is compiled.

Even then at worst we may have to say the IDE is gpld and the LCL is lgpld - 
it can´t have any wider impact than that and I don´t see how that can affect 
anything, after all nobody is building a proprietory derivative of the IDE - 
we are building apps with the LCL.

Ciao
A.J.

-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Executing another application from within a lazarus app

2006-03-07 Thread A.J. Venter
On Tuesday 07 March 2006 14:49, Sam Washkansky wrote:
 Thanks a lot I would appreciate that.
 Cheers
 Sam

Here you go, I´m not going to post the whole huge unit now, just the two 
procedures, you can use them as you see fit, they are pretty much just 
adaptations of the examples in the tutorial anyway (note that they are 
overloaded):

procedure execute (command:string; var output:Tstrings);
{Run command and store the output from it in output 
Notes:
1) do not create output prior to assigning it 
2) you must free output yourself
}
const
  READ_BYTES = 2048;

Var
 Process :Tprocess;
   MemStream : TMemoryStream;
  n: LongInt;
  BytesRead: LongInt;
begin
Process := TProcess.create(nil);;
 Process.CommandLine :=  command;



 {Actually run the thing and catch the output}
  MemStream := TMemoryStream.Create;
  outPut := TStringList.Create;
  BytesRead := 0;

Process.Options := [poUsePipes,poNoConsole];

  Process.Execute;

  while Process.Running do
  begin
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);

// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n  0
then begin
  Inc(BytesRead, n);
end
else begin
  // no data, wait 100 ms
  Sleep(100);
end;
  end;
  // read last part
  repeat
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);
// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n  0
then begin
  Inc(BytesRead, n);
end;
  until n = 0;
  MemStream.SetSize(BytesRead);
  OutPut.LoadFromStream(MemStream);
  MemStream.Free;
 Process.Free;
end;

procedure execute (command:string);
{Execute command, do not wait for it to exit, do
not capture output.}

Var
 Process :Tprocess;
begin
Process := TProcess.create(nil);;
 Process.CommandLine :=  command;
  Process.Options := [poNoConsole];
  Process.Execute;
 Process.Free;
end;


-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: Mozilla Plugin Panel component

2006-03-09 Thread A.J. Venter

   I will write some docs regarding what is working and what isn't.
 
  I will definitely try to help with filling in some of the linux bits at
  least.

 That would be much appreciated!  What part of the component are you
 interested in using? The Adobe Reader or the Flash Player?

Well being mozilla, presumably there is a web-browsing option ? :p

There is a delphi component somewhere that maps to gecko, I have no idea if it 
would work under linux/lazarus though.

GTKSocket and GTKPlug is the way to handle window embedding on linux however, 
and so it seems that my generic embedding components (which are only a design 
so far, haven't had time to write them) may well be of use if tied in with 
yours ?

A.J.

-- 
there's nothing as inspirational for a hacker as a cat obscuring a bug 
by sitting in front of the monitor - Boudewijn Rempt
A.J. Venter
Chief Software Architect
OpenLab International
www.getopenlab.com
www.silentcoder.co.za
+27 82 726 5103

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] Lazarus advocacy : Best App wrtitten in Lazarus

2006-03-14 Thread A.J. Venter
I like this idea, and it ties in with an idea I had, I would like to do a 
series of ¨people behind lazarus¨ interviews, similiar to the ¨people behind 
KDE¨ series from kde dot news, by itself though it wouldn´t work but perhaps 
combined with a site like this it would be a nice section ?

If others like it, I am happy to handle this part - and if Mattias doesn´t 
mind I would like to start with him :)

Ciao
A.J.
On Tuesday 14 March 2006 19:11, Alexsander Rosa wrote:
 Maybe somethink like spreadfirefox.com: uselazarus.com or something like
 that, with a CMS inplace so the mantainers could easily edit/add pages.

 Alex

 2006/3/14, Alexander Todorov [EMAIL PROTECTED]:
  On 3/14/06, Vincent Snijders [EMAIL PROTECTED] wrote:
   I think it would be good to have such a page. I wanted to start it
   here:
   http://wiki.lazarus.freepascal.org/index.php/Lazarus_Application_Galler
  y
  
   A (not-complete) list of candidates can be found here:
   http://wiki.lazarus.freepascal.org/index.php/Projects_using_Lazarus
  
   I was inspired by:
   http://www.freepascal.org/gallery.html
  
   Some of those are lcl applications or written with Lazarus, so they
 
  could be added.
 
   Vincent.
 
IMO the page must be more glamorous than a simple wiki page. Maybe a
  separate page. With a lot of screen shots and description of the used
  programming techniques, classes, DB servers, etc ... All stuff that
  will make you use Lazarus / FPC for development.
  The FPC page is a nice start.
 
  _
   To unsubscribe: mail [EMAIL PROTECTED] with
  unsubscribe as the Subject
 archives at http://www.lazarus.freepascal.org/mailarchives

 --
 Atenciosamente,

 Alexsander da Rosa

-- 
80% Of a hardware engineer's job is application of the uncertainty principle.
80% of a software engineer's job is pretending this isn't so.
A.J. Venter
Chief Software Architect
OpenLab International
http://www.getopenlab.com   | +27 82 726 5103 (South Africa)
http://www.silentcoder.co.za| +55 118 162 2079 (Brazil)

_
 To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


  1   2   3   >