Recent Posts

Pages: [1] 2 3 ... 10
Android / Re: LAMW - SHOWCASE - APP - POST your awesome LAMW app here
« Last post by Mongkey on Today at 07:14:14 am »
Spanish / Re: pregunta sobre liberacion de clases
« Last post by lucamar on Today at 06:16:39 am »
Con la mayoría de clases (si no con todas) no importa demasiado que llames a Free() o directamente al destructor Destroy. Después de todo lo usual es que Free haga nada más que:
Code: Pascal  [Select][+][-]
  1. procedure TObject.Free;
  2. begin
  3.   // the call via self avoids a warning
  4.   if self<>nil then
  5.     self.destroy;
  6. end;
y dado que no es un método virtual prácticamente nadie lo reintroduce para que haga otra cosa; en todo caso, lo usual es delegar cualquier otra tarea para el destructor (Destroy), que sí es virtual.

Usar Free en vez de Destroy se convierte entonces en algo casi puramente convencional y más que nada "defensivo", casi tanto como la usual (y altamente redundante*) secuencia:
Code: Pascal  [Select][+][-]
  1. if Assigned(SomeObject) then SomeObject.Free;

Y por supuesto algo tan convencional, y aunque tenga cierto sentido "defensivo" testear contra Nil antes de llamar al destructor, no amerita enormes letras rojas como si fuera una prohibición divina ;D

* Por clarificar un poco más la redundancia, esa secuencia se convierte en última instancia en algo así como:
Code: Pascal  [Select][+][-]
  1. if SomeObject <> Nil then {if Assigned(SomeObject) then}
  2.   {SomeObject.Free;}
  3.   if SomeObject <> Nil then
  4.     SomeObject.Destroy;
Y aún así es una secuencia muy, muy usada (incluso por mí mismo) :D
Spanish / Re: pregunta sobre liberacion de clases
« Last post by Edson on Today at 05:37:44 am »

Ese método, aunque sea público, no está diseñado para ser llamado de forma directa.  Para destruir un objeto hay que llamar al método Free.

Alguien que me explique por qué no debo llamar a Destroy() y sí a Free(). Tengo varios años programando, cientos de programas y miles de llamadas a Destroy(), sin tener ningún problema. Tal vez he vivido engañado toda mi vida.  :o
LCL / Re: form resize event not firing correctly.
« Last post by jamie on Today at 04:59:54 am »
have a look at this that I slapped together to give an idea of a smooth sizing..

I use code much like this in a couple of apps to maintain aspect ratio..

I must say the LCL leaves a lot to be desired. So many hacks in the TWinControl file its a wonder it can move out of its own way..

So attached is something that uses both the WindowPosChanging and WM_Sizing, not WM_SIZE..

grab the sides with your mouse and change sizes, watch how the other angle changes size..

 I have much less trouble in Delphi, it seems things work as they should when it comes to handling these special cases.. I think some of this code in the LCL needs a serious weight loss program.
I had the same issue, and could not get it to work with  .mo files. 
I decided to distribute the  .po files.
FPC development / Re: Case statement does not handle all possible cases
« Last post by speter on Today at 04:02:21 am »
The discussion above prompted me to look at my old pascal code. I found (to my surprise) that Microsoft's Pascal compilers used else...otherwise (I used v3.13, v3.31 & v4). I had totally forgotten about using "otherwise" with Microsoft's compilers.

I also found a program I wrote in 1989 to convert my 'old' pascal code to the Turbo Pascal dialect; that included substituting "else" for "otherwise". :)

FPC development / Re: Case statement does not handle all possible cases
« Last post by nanobit on Today at 03:45:53 am »
I think it was TP that introduced the else-clause and the possibility of a fall-through/bypassed case-statement. For Delphi-compatibility the FPC adopted this malpractice. Pascal is very well designed and there are reasons why all possible case-labels have to appear in case-statements.

For exactness it should be noted here that "else" in FPC has a different meaning than "else" in Delphi, C++, C#.
The latter languages implement "all other values of underlying type", FPC implements only "all other defined values".
General / Re: It has a little bug in IDE
« Last post by y.ivanov on Today at 02:53:55 am »
Well, let's argue whether to put a semicolon in C as follows {{};};
I'm bailing out of this...

Good point. It is written in the subject: it is about the IDE.
Maybe it must be discussed elsewhere.

I'd throw in a couple of related points before this discussion completely winds down. First, at least some of the ALGOL implementations describe anything after END as being an implicit comment, with minimal consideration of the status of ; in that context. Second, the END. at the end of an ALGOL (hence Pascal) program was a non-standard "hack" from Burroughs that allowed the compiler to decide that it had seen enough without reading the next card which would potentially have screwed up the remainder of the batch job (and their compilers insist that nothing follow it).

I've spent a bit of time over the last few weeks looking at Verilog and VHDL, and it's an interesting exercise speculating which bits are unarguably ALGOL, which bits are unarguably Ada, and which bits are probably Ada but the sub-sub-sub-committee had their own idea about the END behaviour and didn't agree with the guys in the next office :-)

Mark, thanks for sharing this. I'm personally very curious about such a first-person views on a computers development (and this is with the utmost respect). The time the computers came in my country, or I came into computers, it was about ~10 years gap from the IT developed (western) countries. That was the time for the engineers to reverse engineer the  IBM/360, VAX PDP-8, VME, etc. The clones were declared as genuine, the others were not mentioned at all.
So, I'm now truly interested in that unknown (for me) development. Languages as ALGOL, MPL, even COBOL - these are lost, skipped for me. But, as it turns out, every one of these has its implications on what we do now.

As I previously said, maybe it is a subject for a separate discussion.
General / Re: Adding a Laz-built program to Ubuntu Favorites?
« Last post by dbannon on Today at 02:34:14 am »
You don't mention which desktop you are using, you question is really a "Desktop Question".

If using the default Gnome (yek !) desktop and you want it to appear in the dock, typically down the left side, open the app in question, its icon appears in the dock, right click the icon and choose add to favourite.

If using one of the other desktops such as Mate, open the menu, right click the entry for the app in question and choose "pin to favourite".

If these don't work, you need to ask the Desktop people, its not a Lazarus issue I am afraid.

Spanish / Re: pregunta sobre liberacion de clases
« Last post by 440bx on Today at 01:46:57 am »
never use big red letters
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018