Re: [Lazarus] Why you got to hate Visual Basic

2011-11-23 Thread DSK

Graeme,


This just confirms my thoughts that Visual Basic is such a toy
language, you can't do any real work in it! Lets rather stick to a real
programming language like Object Pascal.


Simply just not true ...
shakes head and wanders off.

--
DSK
Posted with XanaNews 1.19.1.320


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


Re: [Lazarus] screen.cursor := crHourglass and Linux

2011-04-19 Thread DSK
On Tue, 19 Apr 2011 08:25:49 +0200, Graeme Geldenhuys wrote:

 NOTE:
 The issue is only if you call DisplayCursor() without storing the result
 in a local variable.

Good lord.  That's a very interesting gotcha. I'm very appreciative 
that you've caught this.

It seemed to work fine in the trivial example that I used to test it but 
then, it would seem that I didn't test it very well now did I. After 
putting a break-point in the Destroy event [after wasting 3 hours of my 
live trying find out how to write to the messages window - and failing] 
it does stop there right after the object is created.

It would seem then that the only option is to create a variable where-
ever you want to change the cursor for the extent of the method it is 
declared in ... bummer.

Thanks,
Dave

PS, I'm using the git repository that you maintain - HUGE thanks for this.


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


Re: [Lazarus] screen.cursor := crHourglass and Linux

2011-04-19 Thread DSK
On Tue, 19 Apr 2011 08:55:00 +0200, Graeme Geldenhuys wrote:

 FPC I believe frees the
 temporary interface reference immediately (or something undefined - I
 can't remember).

This is exactly what I see happening in the testing I've just done.

Plop a;
Application.ProcessMessages;
in Destroy right after changing the cursor back to what was stored as 
FOldCursor and it appears that the cursor does not change at all.

-- 
Dave


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


Re: [Lazarus] screen.cursor := crHourglass and Linux

2011-04-19 Thread DSK
On Tue, 19 Apr 2011 08:25:49 +0200, Graeme Geldenhuys wrote:

 The issue is only if you call DisplayCursor()

Actually, just for the record, it is the same for DisplayHourglass as 
well.

-- 
Dave


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


Re: [Lazarus] screen.cursor := crHourglass and Linux

2011-04-18 Thread DSK

John,


do i really need allways
screen.cursor := crHouglass;
followed by
Application.Processmessages;


I have this bit of code I wanted to send but I wasn't going to post it 
without testing it [I've only ever run it on windows apps] on a Linux 
platform and I had some difficulties getting Lazarus on Ubuntu running - 
but that's another story. It's a bit of code I found ages ago and have 
refactored here and there. It makes dealing with changing to the HourGlass 
and back in any method much simpler to deal with ... at any rate here it is:


*
unit CursorCtrl;

interface
uses
  Controls, Forms;

type
  ITemporaryCursor = interface
  ['{38BDD5A3-2E23-47D1-BD5D-54C49DBC95C3}']
procedure Show;
  end;

  TTemporaryCursor = class(TInterfacedObject, ITemporaryCursor)
  private
FOldCursor: TCursor;
FNewCursor: TCursor;
  public
constructor Create(const Cursor: TCursor = crHourglass);
destructor Destroy; override;
procedure Show;
  end;

function DisplayCursor(const Cursor: TCursor): ITemporaryCursor;
function DisplayHourglass: ITemporaryCursor;

implementation

{ TTemporaryCursor }
constructor TTemporaryCursor.Create(const Cursor: TCursor = crHourglass);
begin
  inherited Create();
  FOldCursor := Screen.Cursor;
  FNewCursor := Cursor;
end;

destructor TTemporaryCursor.Destroy;
begin
  Screen.Cursor := FOldCursor;
  inherited;
end;

procedure TTemporaryCursor.Show;
begin
  Screen.Cursor := FNewCursor;
  Application.ProcessMessages;
end;

{Use these routines to change a cursor before a long process in any method.}

function DisplayCursor(const Cursor: TCursor): ITemporaryCursor;
begin
  Result := TTemporaryCursor.Create(Cursor) as ITemporaryCursor;
  Result.Show;
end;

{- or -}

function DisplayHourglass: ITemporaryCursor;
begin
  Result := TTemporaryCursor.Create as ITemporaryCursor;
  Result.Show;
end;

end.

*
To use it, add the unit to the implementation uses clause and then just 
call DisplayHourglass before any long process. It'll switch back to 
whatever the cursor was then the method terminates.


Hope you find it of interest.
--
Dave
Posted with XanaNews 1.19.1.320


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


Re: [Lazarus] screen.cursor := crHourglass and Linux

2011-04-16 Thread DSK

John,


but for  linux you need:
screen.cursor := crHourglass;
Application.ProcessMessages;


the Application.ProcessMessages; line helps on Windows as well and [now 
that I check] is in the WaitCursor unit that I generally use ... sorry I 
trimmed it in the quote.


--
DSK
Posted with XanaNews 1.19.1.320


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


Re: [Lazarus] screen.cursor := crHourglass and Linux

2011-04-15 Thread DSK

John,


do i really need allways
screen.cursor := crHouglass;


Yes, your program is responsible for indicating that you have started [or 
finished] a long process.


--
DSK
Posted with XanaNews 1.19.1.320


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


Re: [Lazarus] inconviniance....

2011-03-17 Thread DSK

Rich,

and then clicking via explorer on some file it will open another  instance 
of lazarus


I agree with Eduard that this is annoying and we should have the ability 
to NOT have the last project automatically loaded when Lazarus starts. Is 
that not a configuration choice?


The ability to NOT have the last project automatically loaded when Lazarus 
starts does exist.

Environment
Options

Environment,
Open last project on start checkbox.

That won't work if it's a file you have [dbl]clicked on ... Eduards case.

Not sure what would solve the problem Eduard has ... some want to be able 
to open additional IDEs.

--
DSK
Posted with XanaNews 1.19.1.269


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


Re: [Lazarus] inconviniance....

2011-03-17 Thread DSK

Rich,

If the Open last project on start is not checked, why does the IDE open 
the last project when you double click on a Pascal source file? Seems 
completely wrong to me.


A now I get it ... yea, I agree that's not good. I'd use a word [maybe 
several] other than inconvenient that's for sure :)


--
DSK
Posted with XanaNews 1.19.1.269


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


Re: [Lazarus] Newbie

2011-03-05 Thread DSK

Milan,


I see no progress, only result 10.


Try for i:=0 to 1 and comment out //sleep ..
[set progressbar1.max to 1 as well]

--
DSK
Posted with 1.19.1.269


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


Re: [Lazarus] Newbie

2011-03-05 Thread DSK

Howard,


Try for i:=0 to 1 and comment out //sleep ..


This will fail - he's declared i as shortint


Nice catch, thanks. I never even looked but used to do exactly the same - 
using the smallest possible type for the task at hand ... he'll just have 
to change it to integer then I guess :)


--
DSK
Posted with 1.19.1.269


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


[Lazarus] Passing Enum as Parameter

2011-02-25 Thread DSK
Tired of thunking my head against the monitor trying to figure this out. 
I'm trying to port a tool written in Lazarus to Delphi. The tool uses 
tiOPF is called tiMapper and I'm trying to build the accompanying test 
unit. One of the huge number of compile errors I'm trying to sort out is:

functionFindByGender(const AGender: enum): integer;
[DCC Error] person_bom.pas(92): E2003 Undeclared identifier: 'enum'

Is 'enum' a valid identifier in Lazarus?

Sorry but F1 provides nothing and google comes back with 17 bazillion hits 
and not one means a damn thing to me.


Thanks,
--
DSK
Posted with 1.19.1.269


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


Re: [Lazarus] Passing Enum as Parameter

2011-02-25 Thread DSK

Mattias,


functionFindByGender(const AGender: enum): integer;
[DCC Error] person_bom.pas(92): E2003 Undeclared identifier: 'enum'

Is 'enum' a valid identifier in Lazarus?


Yes.
That means: it is not a keyword you can use it as an identifier.


There is no type or declared identifier enum in FPC ... thanks.


Have you searched for 'enum' in the tiOPF sources? Maybe you have to
add a unit to your uses section.


Yes I have looked, but it's likely worth another try. I'll have to have 
another look in the remaining project files as well.


Thanks,
--
DSK
Posted with 1.19.1.269


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


[Lazarus] Play WAV Example

2011-02-12 Thread DSK

Greetings,

Banging my head against the monitor trying to figure out what should be 
the simplest thing possible. As part of a bigger project, I'm wondering if 
someone here can point me toward an example program ... here's the 
parameters:

It plays a selected WAV file.
It works on both Windows and Linux.

Anyone know of one? Thanks.

--
DSK
Posted with 1.19.1.269


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


Re: [Lazarus] I am just wondering

2011-02-04 Thread DSK

Zelimir,

Is there any VB6 to Lazarus translator, and how difficult would be to make 
one


You will have much better luck searching for VB to Delphi -or- VB to 
Pascal. There are a few around none that work all that well in my 
experience -but- I haven't looked at them in years.


--
DSK
Posted with 1.19.1.269


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


Re: [Lazarus] Does Lazarus support a complete Unicode Component Library?

2011-01-01 Thread DSK

Juha,


... so UTF8 is also unicode?
I am still confused with all the encodings and string types.


The best article ever on it ...
http://www.joelonsoftware.com/articles/Unicode.html

--
DSK
Posted with 1.19.1.269


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