* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Unable to install BGRA controls
« Last post by metal mark on Today at 02:23:08 pm »
SOLVED - It worked.
Thank you for your advice, it was me being a bit dim that slowed things up. Don't know how I managed to download the wrong package manager but ha ho got the right one this time. Working out how to compile and install the package took some time but got there. Just need to do the same on my Raspberry Pi and get rpi_hal working on it so that  I can get my pressure gauge and pressure senser system working. A click  by click paper on this would be awfully useful for old foggies like me, where would I put that if I can one done.
Thanks a lot for your help.
Kind regards MM.
2
General / Re: Restart a program
« Last post by copY on Today at 02:19:38 pm »
Thank you man. But there is some problems, i dont have an android phone, I'm using iPhone, but i already discoveres Xcode (uses swift language) which is a good program for writing games and applications for iOS.
This XO game is need to be in pascal, because it's a homework and the teacher asked us to write in Pascal, using crt and stuff.
In freepascal the method worked with crt too, but I wanted to change to a better program to write in Pascal, because for me the FreePascal is very old fashioned. (Before that i used Codeblocks).
I saw that post is answered but i cant understand that. (i downloaded Lazarus yesterday).
~copY
3
General / Re: Restart a program
« Last post by Handoko on Today at 02:11:12 pm »
I saw that post, it's already answered. I do not use crt, nothing much I can say. I recommend to to use 'better' graphics or game engine.

Here is a list of available game engines (for Pascal):
http://wiki.freepascal.org/Game_Engine

I recommend you to use SDL, Castle Game Engine or Allegro. They are easier than you expected. But if just want to create very very simple games, you can use BGRABitmap as the graphics engine. It has very good tutorials:
http://wiki.lazarus.freepascal.org/BGRABitmap_tutorial

But if you just want to write games easily, you may try ZGameEditor. It has everything you need to write games (audio generator, collision, 2D, 3D, etc). It allow you to export your games to Android, and it has Pascal-like scripting language.
4
Beginners / Re: Unit path: "-Fu" and "$UNITPATH"
« Last post by qq9ebg9acvzx on Today at 02:09:24 pm »
Ehhhm, how about this ?

first,
DISCLAIMER: I am not responsible of any damage arising in any way out of the use of this script

/bin/runpas:
Code: Bash  [Select]
  1. #!/bin/sh
  2. pas=`basename $1`
  3. exe=${pas%\.*}
  4. mkdir -p /tmp/runpas;
  5. mkdir -p /tmp/runpas/bin;
  6. mkdir -p /tmp/runpas/units;
  7. sed '1d' $pas>tmp_runpas_$pas
  8. fpc -FE/tmp/runpas/bin -FU/tmp/runpas/units tmp_runpas_$pas>/tmp/runpas/runpas.log 2>/tmp/runpas/runpas.err
  9. rm tmp_runpas_$pas
  10. /tmp/runpas/bin/tmp_runpas_$exe
  11.  

this copies and compiles main file in-place (except first line). It uses executable output path and unit output path parameters of fpc to redirect those files to temporary folder instead of moving main source file. So
$UNITPATH should keep working.
OK, this gave me an idea to create a script that would act as interpreter instead of running "instantfpc" as interpreter directly.

Then I made this script:
Code: Bash  [Select]
  1. #! /bin/bash
  2. INSTANTFPCOPTIONS='-Mobjfpc -O3 -Sih -viewnh -Fu/usr/include/*;/usr/local/include/* -XMmain -Xs -XS -XX';
  3.  
  4. export INSTANTFPCOPTIONS;
  5.  
  6. instantfpc "$1"
  7.  


Then I just need to specify that script as interpreter: "#! /usr/local/bin/myscript.sh" instead of "#! /usr/bin/instantfpc".

And then just run the script normally: "./instantfpc_script.sh"


If you want a more portable alternative but be limited in number of options, you can specify a one line argument to the interpreter, as far as I know BASH allows only 1 option; like this:
Code: Bash  [Select]
  1. #! /usr/bin/instantfpc -Fu/usr/include/*;/usr/local/include/*
  2.  


This solution is OK for now, but it would be better if the "$UNITPATH" directive worked. If you know of a better alternative, please let me know.

Thank you very much for your help and time, people!
5
Third party / Re: Fpcupdeluxe
« Last post by BSaidus on Today at 02:06:14 pm »
Ooops !!
  I've got an error when compiling lazarus in GhostBSD 32 environnement.
here is a log :
 
Code: Pascal  [Select]
  1.  [2017-04-23 13:37:36.897 Info] Executing : gmake "FPC=/root/Dev/fixes/fpc/bin/i386-freebsd/fpc.sh" "USESVN2REVISIONINC=0" "--directory=/root/Dev/fixes/lazarus" "INSTALL_PREFIX=/root/Dev/fixes/lazarus" "FPCDIR=/root/Dev/fixes/fpcsrc" "UPXPROG=echo" "COPYTREE=echo" "OPT=-vw-n-h-i-l-d-u-t-p-c-x- -Fl/usr/local/lib -Fl/usr/X11R6/lib" "lazbuild" (working dir: /root/Dev/fixes/lazarus)
  2.  
  3.  [2017-04-23 13:37:36.921 Info] gmake: Entering directory '/root/Dev/fixes/lazarus'
  4.  
  5.  [2017-04-23 13:37:36.926 Info] gmake -C packager/registration
  6.  
  7.  [2017-04-23 13:37:36.929 Info] gmake[1]: Entering directory '/root/Dev/fixes/lazarus/packager/registration'
  8.  
  9.  [2017-04-23 13:37:36.932 Info] /bin/rm -f ../units/i386-freebsd/fcllaz.ppu
  10. /bin/mkdir -p ../units/i386-freebsd
  11. /root/Dev/fixes/fpc/bin/i386-freebsd/fpc.sh -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Fu. -Fu/root/Dev/fixes/fpcsrc/rtl -FE. -FU../units/i386-freebsd -vw-n-h-i-l-d-u-t-p-c-x- -Fl/usr/local/lib -Fl/usr/X11R6/lib -di386 fcllaz.pas
  12.  
  13.  [2017-04-23 13:37:36.991 Info] Error: (11006) Illegal parameter: Thread/5.4.0
  14. Error: /root/Dev/fixes/fpc/bin/i386-freebsd/ppc386 returned an error exitcode
  15. gmake[1]: *** [Makefile:2702: fcllaz.ppu] Error 1
  16. gmake[1]: Leaving directory '/root/Dev/fixes/lazarus/packager/registration'
  17. gmake: *** [Makefile:3050: registration] Error 2
  18. gmake: Leaving directory '/root/Dev/fixes/lazarus'
  19.  
  20.  
  21.  
6
General / Accessing interfaces from the outside
« Last post by loaded on Today at 02:02:29 pm »
Hi All

Firstly;
I'm asking this question because I can use the generic Unique Identifier in interfaces.

Sample ;
Quoted from the http://stackoverflow.com/questions/12954973/putting-classes-in-a-dll

Code: Pascal  [Select]
  1. // The Interface-Deklaration for Main and DLL
  2. unit StringFunctions_IntfU;
  3.  
  4. interface
  5.  
  6. type
  7.   IStringFunctions = interface
  8.     ['{240B567B-E619-48E4-8CDA-F6A722F44A71}']
  9.     function CopyStr( const AStr : WideString; Index, Count : Integer ) : WideString;
  10.   end;
  11.  
  12. implementation
  13.  
  14. end.
  15.  

How can I access interfaces from an external exe with the CreateOleObject method like COM objects?

Code: Pascal  [Select]
  1. var
  2.   ComObje: OleVariant;
  3. begin
  4.     ComObje:= CreateOleObject('?');
  5.  

Respects.
7
FV/Textmode IDE / Re: FreePascal text mode dialog designer for Free Vision
« Last post by avra on Today at 02:00:16 pm »
Ok, after getting used to it all components work except ListBox. Here is generated code for a dialog with Buttons, StaticText, ParamText, InputLine, RadioButtons, CheckBoxes and MultiCheckBoxes:

Code: Pascal  [Select]
  1. unit ComplexDialog;
  2.  
  3. interface
  4.  
  5. uses Objects, Views, Dialogs;
  6.  
  7. { TestDialog }
  8.  
  9. type
  10.         PTestDialog = ^TTestDialog;
  11.         TTestDialog = object(TDialog)
  12.                 constructor Init;
  13.         end;
  14.  
  15.         PTestData = ^TTestData;
  16.         TTestData = record
  17.                 ParName1: ;
  18.                 LabelDataName: string[80];
  19.                 Mode: word;
  20.                 Options: word;
  21.                 Choices: longint;
  22.         end;
  23.  
  24. implementation
  25.  
  26. uses Menus;
  27.  
  28. { TestDialog }
  29.  
  30. constructor TTestDialog.Init;
  31. var
  32.         R: TRect;
  33.         RB: PRadioButtons;
  34.         CB: PCheckBoxes;
  35.         MB: PMultiCheckBoxes;
  36. begin
  37.         R.Assign(4, 4, 65, 47);
  38.         inherited Init(R, 'Test Dialog');
  39.         Options:= Options or ofCentered;
  40.  
  41.         R.Assign(48, 39, 58, 41);
  42.         Insert(New(PButton, Init(R, '~O~k', cmOK, bfDefault)));
  43.  
  44.         R.Assign(36, 39, 46, 41);
  45.         Insert(New(PButton, Init(R, 'C~a~ncel', cmCancel, bfNormal)));
  46.  
  47.         R.Assign(2, 2, 15, 3);
  48.         Insert(New(PStaticText, Init(R, 'MyStaticText1')));
  49.  
  50.         R.Assign(18, 2, 30, 3);
  51.         Insert(New(PParamText, Init(R, 'MyParamText1', 0)));
  52.  
  53.         R.Assign(3, 39, 26, 41);
  54.         Insert(New(PButton, Init(R, '~M~yButton', cmMyButton, bfBroadcast)));
  55.  
  56.         R.Assign(2, 5, 57, 6);
  57.         IL:= New(PInputLine, Init(R, 80));  Insert(IL);
  58.         R.Assign(2, 4, 14, 5);
  59.         Insert(New(PLabel, Init(R, '~L~abel name', IL)));
  60.  
  61.         R.Assign(2, 8, 17, 10);
  62.         RB:= New(PRadioButtons, Init(R,
  63.                 NewSItem('Radio1',
  64.                 NewSItem('Radio2',
  65.                 nil))
  66.         ));  Insert(RB);
  67.         R.Assign(2, 7, 8, 8);
  68.         Insert(New(PLabel, Init(R, '~M~ode', RB)));
  69.  
  70.         R.Assign(2, 12, 22, 15);
  71.         CB:= New(PCheckBoxes, Init(R,
  72.                 NewSItem('Checkbox1',
  73.                 NewSItem('Checkbox2',
  74.                 NewSItem('Checkbox3',
  75.                 nil)))
  76.         ));  Insert(CB);
  77.         R.Assign(2, 11, 11, 12);
  78.         Insert(New(PLabel, Init(R, '~O~ptions', CB)));
  79.  
  80.         R.Assign(2, 18, 25, 22);
  81.         MB:= New(PMultiCheckBoxes, Init(R,
  82.                 NewSItem('MultiCharacter1',
  83.                 NewSItem('MultiCharacter2',
  84.                 NewSItem('MultiCharacter3',
  85.                 NewSItem('MultiCharacter4',
  86.                 nil)))), 5, cfFourBits, '@#$%&'));
  87.         Insert(MB);
  88.         R.Assign(2, 17, 11, 18);
  89.         Insert(New(PLabel, Init(R, '~C~hoices', MB)));
  90. end; {TTestDialog.Init}
  91.  
  92. begin end.
  93.  
8
General / Re: Restart a program
« Last post by copY on Today at 01:58:50 pm »
Thank you, these replies helps a lot, im actualy a newbie. I am in the 9th grade, i started programming in C++ in the 5th grade, so Pascal is a little bit new for me. I have another question, i saw something like this but i didnt understand the method. I have to draw to the console a little window or table for the XO game, and the characters aren't the same after i write the uses crt command (i have to use that for gotoxy and clrscr). Can i solve this somehow?
~copY
9
General / Re: Restart a program
« Last post by Handoko on Today at 01:52:18 pm »
I do not against using goto. Actually it is very easy to understand for newbies. But the problem of using several gotos, especially when overlapped together, will usually make the code hard to predict or debug.

Read more about goto:
http://wiki.freepascal.org/Goto

Read more about repeat - until:
http://wiki.freepascal.org/REPEAT..UNTIL
10
General / Re: How to return special keys (e.g., Alt+H)
« Last post by dculp on Today at 01:52:06 pm »
Molly --

Quote
Again, do note that certain key combinations are simply 'hijacked' by Windows and will never reach your code.

I considered this. However, Ctrl+O (open-file) isn't hijacked so I assume that Ctrl+S (save-file) would also not be hijacked. Is there any way to determine if a key combination is being hijacked?

In any case, any work-around for Ctrl+S?
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