* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
Linux / Re: Linux-Lazarus-Indy
« Last post by Remy Lebeau on Today at 02:33:00 am »
Downloaded and installed latest nightly Indy10-10.6.2.5468 sans issues. Run the transliteration app again and got exactly the same results as before. The quick answer is that example 1 passes with flying colours while example 2 fails.

I've already explained the difference between the 1st and 2nd examples.  You haven't addresses any of the issues I've described.  Which mode are using FreePascal in?  Does the 'string' type map to AnsiString or UnicodeString? If AnsiString, did you do any tests using the extended examples I have shown where IndyTextEncoding_OSDefault is used as an intermediate conversion?

Do you think I had to compile Indy twice as with older versions?

I have no idea.  I don't have FreePascal/Lazarus installed, let alone tried to ever install Indy in it.
2
Beginners / Find repeated elements in an array.
« Last post by DarkDiosito on Today at 02:08:17 am »
Hello!

I'm making a hangman game in Pascal for a study project and I'm having trouble with this part.

Let's say the word is "mom", if the player wants to guess the letter "m" the program should return that the letter "m" is in the 1st and 3rd position.

The code used to find elements in the array is the following:

Code: Pascal  [Select]
  1.                 repeat
  2.                     c := c+1
  3.                 until (word[c] = letter) or (c >= wordlength);
  4.  
  5.                 position := c;
  6.  
  7.                 if (word[c] = letter)
  8.                         then                                            
  9.                             begin                                        
  10.                                  repeat                                  
  11.                                        z:=z+1
  12.                                  until (correct[z] = letter) or (z >= wordlength);
  13.  
  14.                                  if correct[z] = letter
  15.                                     then
  16.                                         begin                                            
  17.                                              writeln('This letter has already been guessed correctly')
  18.                                         end
  19.                                     else
  20.                                         begin
  21.                                              correctAmout := correctAmount+1;
  22.                                              correct[position] := letter;
  23.                                              writeln('CORRECT!');
  24.                                              WriteLn;
  25.                                              for y := 1 to wordlenght do
  26.                                                  Write(correct[y]);
  27.                                         end;
  28.                             end
  29.                          ...
  30.                      

Being "word" the array that contains the original word and "correct" the array that contains the already correctly guessed letters.

Obviously this code is wrong because it jumps out of the searching process as soon as it founds a match, which is not good.

I tried a few things and couldn't get it working and have absolutely no idea how to make this right.

If anyone has an idea, I would be very welcome!
3
Audio and Video / Midi Sequencer, conversion from Delphii, errors...
« Last post by u2o on Today at 01:57:24 am »
Hi!

I'm trying to convert Midi Sequencer from Delphi, to Lazarus...

  Project site: https://sourceforge.net/projects/midisequencer/

After some modifications, it's compiled...

Replaced functions
Code: Pascal  [Select]
  1. WideStrings() to WideString()

Adding Units
Code: Pascal  [Select]
  1. uses
  2.    Windows ...

But, I don't undestand one error... "RunError(127)"...

It's produced when is executed AllocateHwnd and DeallocateHwnd...


Code from MSC_Out_Device.pas

Code: Pascal  [Select]
  1. unit MSC_Out_Device;
  2.  
  3. {$MODE Delphi}      
  4.  
  5. type
  6.   TMIDI_Device_Output = class (TMIDI_Device)
  7.     protected
  8.       procedure MidiOutput (var Message: TMessage);  
  9.     public
  10.       constructor Create (AOwner:TComponent); override;
  11.       destructor Destroy; override;  
  12. end;
  13.  
  14. procedure Register;
  15.  
  16. {-------------------------------------------------------------------}
  17. implementation
  18.  
  19. {-------------------------------------------------------------------}
  20. procedure Register;
  21. begin
  22.    RegisterComponents (MSC_Package_Name, [TMIDI_Device_Output]);
  23. end; // Register
  24.  
  25. {-------------------------------------------------------------------}
  26. constructor TMIDI_Device_Output.Create(AOwner:TComponent);  
  27. begin
  28.    inherited Create(AOwner);
  29.  
  30.    FState   := mosClosed;
  31.    FNumdevs := midiOutGetNumDevs;
  32.  
  33.    { Create the window for callback notification }
  34.    if not (csDesigning in ComponentState) then
  35.    begin
  36.       Handle := AllocateHwnd(MidiOutput);
  37.    end; // if
  38.  
  39.  
  40. end; // Create //
  41.  
  42. {-------------------------------------------------------------------}
  43. destructor TMIDI_Device_Output.Destroy;
  44. begin
  45.    if FState = mosOpen then Close;
  46.    if (PCtlInfo <> Nil) then GlobalSharedLockedFree( PCtlinfo^.hMem, PCtlInfo );
  47.  
  48.    DeallocateHwnd(Handle);
  49.  
  50.    inherited Destroy;
  51. end; // Destroy //  
  52.  
  53. {-------------------------------------------------------------------}
  54. procedure TMIDI_Device_Output.midioutput (var Message: TMessage);
  55. { Triggered when sysex output from PutLong is complete }
  56. var MyMidiHdr: TMyMidiHdr;
  57.     thisHdr: PMidiHdr;
  58. begin
  59.  
  60.    if Message.Msg = Mom_Done then
  61.       begin
  62.       { Find the MIDIHDR we used for the output. Message.lParam is its address }
  63.       thisHdr := PMidiHdr(Message.lParam);
  64.  
  65.       { Remove it from the output device }
  66.       midiOutUnprepareHeader(FMidiHandle, thisHdr, sizeof(TMIDIHDR));
  67.  
  68.       { Get the address of the MyMidiHdr object containing this MIDIHDR structure.
  69.          We stored this address in the PutLong procedure }
  70.       MyMidiHdr := TMyMidiHdr(thisHdr^.dwUser);
  71.  
  72.       { Header and copy of sysex data no longer required since output is complete }
  73.       MyMidiHdr.Free;
  74.  
  75.  
  76.       { Call the user's event handler if any }
  77.       if Assigned(FOnmidioutput) then
  78.          FOnmidioutput(Self);
  79.       end;
  80. // there is no case for MOM_PLAYBACK_DONE
  81. end; // midioutput //        

The procedure
Code: Pascal  [Select]
  1. procedure TMIDI_Device_Output.midioutput (var Message: TMessage);

is not executed, fails on
Code: Pascal  [Select]
  1. Handle := AllocateHwnd(MidiOutput);

Can someone give me a hand?
4
Linux / Re: Linux-Lazarus-Indy
« Last post by scasparz on Today at 12:31:19 am »
Downloaded and installed latest nightly Indy10-10.6.2.5468 sans issues. Run the transliteration app again and got exactly the same results as before. The quick answer is that example 1 passes with flying colours while example 2 fails.

Tried to log execution path again for the second example, focusing on the first run only, that seems the run which matters. Noticed GDB behaves erratically. Jumps mid-subprograms omitting whatever lies before rather than starting from their beginning, or jumps over grayed code -presume disabled- etc. none of which makes any sense to me. This was not like yesterday when at least GDB seemed to behave itself. Me believes this affects Indy code only, as GDB behaviour on Lazarus code appears to be the usual. Do you think I had to compile Indy twice as with older versions?

Suspect but am far from being certain somehow my Lazarus installation could be corrupted, perhaps by installing or unistalling a number of Indy’s versions and rebuilding Lazarus each and every time. Intend to purge Lazarus and attempt a fresh installation in the hope of fixing these issues.

Will come back as soon as I have something.
5
General / Re: delphi and C++ builder community edition is here...
« Last post by Phil on Today at 12:21:06 am »
I just go to the website and they give me a license key plus the setup without asking anything about my incomes. That's the reality.

That sounds great. Should be useful in a number of ways. For example, just compiling code with both FPC and Delphi should be very interesting for checking compatibility, inserting IFDEFs to work around differences, performance, etc.
6
General / Re: delphi and C++ builder community edition is here...
« Last post by lainz on Today at 12:17:28 am »
I just go to the website and they give me a license key plus the setup without asking anything about my incomes. That's the reality.

And then, I started to receive mails from embarcadero partners to get started with Delphi, with some free webinars from 'Unisolutions' http://www.unisolutions.com.ar/.
7
General / Re: delphi and C++ builder community edition is here...
« Last post by Phil on Today at 12:00:01 am »
To "get around" the license restrictions make sure you own a business which is hired to do work, as opposed to having people hire you.

Not sure if I follow. The EULA mentions companies too.

In any case, Delphi's challenges have less to do with license terms than they do with macro trends in software development. If you look at this little article posted yesterday…

https://community.embarcadero.com/blogs/entry/introducing-delphi-cplusplusbuilder-community-edition

…you see Delphi Community Edition's target demographic: "freelance developers, startups, students and non-profits." What do startups, students and non-profits have in common? Well, no money for one, at least not at first. So it makes sense to make it free for them.

Everybody is chasing startups these days. For example, if you're a legitimate startup, you may qualify for US$ 10,000 in AWS credits from Amazon. A startup that grows into a much bigger company is likely to stay with AWS for their Web apps and services rather than move to something else (Azure).

One problem for Delphi with this line of thinking is that startups and students often don't use Windows. Delphi's compilers and IDE only run on Windows. But if you're doing mobile development, you probably have a Mac. And startups and students generally don't do much desktop app development, which would normally target Windows. And if you have Linux servers, Delphi Community Edition / Professional does not target Linux.

Even Microsoft has a Mac IDE now that targets iOS and Android, but that was only via acquisition, from a culture that understood Mac and mobile, albeit through a C# lens. Creating a Mac IDE from scratch was probably never an option, and is probably not an option for Delphi either. You can see a similar issue with Lazarus on Mac, where it's not very Mac-friendly and does not support iOS development, and thus would not hold much appeal for many of those "freelance developers, startups, students and non-profits."

It's been said that iPhone was Windows' extinction event. If so, then it follows that many of the languages and tools associated with traditional Windows desktop app development would also be in decline. The mammals won.

https://pypl.github.io/PYPL.html

http://go.flatironschool.com/beyond-the-bootcamp?utm_campaign=Blog%20Posts&utm_source=Blog#Language-Trends

https://www.itwriting.com/blog/11008-remobjects-elements-mix-and-match-languages-and-platforms-as-you-like.html
8
Mac OS X / Re: TSaveDialog wrong directory
« Last post by MISV on July 19, 2018, 11:53:32 pm »
I use fpcupdeluxe to get cocoa trunk - it much newer than 1.8.4

I only have a few serious issues left in a huge application. The bugs I can create a bug report for gets fixed quickly
9
General / Re: delphi and C++ builder community edition is here...
« Last post by R0b0t1 on July 19, 2018, 11:45:12 pm »
I think as I read it that any income counts.
It can't be any income. Welfare is considered income in the US (though is not taxable) so if you were so poor as to receive it should all of it go towards a license?

The wording indicates the income is associated with a legal entity, as is the license. That is if your company purchased a license and you used it it is still the company's license.

To "get around" the license restrictions make sure you own a business which is hired to do work, as opposed to having people hire you. This is just good sense in general as in most jurisdictions it protects you from a lot of liability and has tax benefits.

If your main line of work is not software and you are not an independent consultant then you fit the license terms under "individual" or "student." You could also attempt to claim the license under "individual" if you ran a sole proprietorship. In that case the license would not confer the ability to your sole proprietorship to use the software to author any binaries.

This is exciting, as I hope to experiment with some of the features in Delphi not in FPC yet. Hopefully it will help when adding them.
10
I would love to see a demo test case for this. I wish I had luck creating one...

In my real project - not only do I see the problem reported here. I also have another toolbar (in the left side) where child controls including toolbuttons go invisible for no good reason known to me (works in Lazarus/Carbon and Delphi/Windows)

If I then click where the controls are supposed to be - they become visible for a time. Calling repaint explicitly does not seem to help much. (But maybe calling at wrong times compared to when they become invisible)

Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus