* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Some problems in Lazarus 1.8.4 that I had
« Last post by valdir.marcos on Today at 07:23:01 am »
The problem with Caption in buttons persist,but I will go see well before post it.
When working with TActionList, you should plan even more before act. I mean, you should think and build all TAction before building TMainMenu, TPopMenu, TToolBar, TCoolBar, TButton, TSpeedButton and TImageList.
Captions are handled easily, automatically and correctly.
To show the images from the TImageList at design-time, you need to set it to all involved components.
See a very small example attached.

http://www.drbob42.com/delphi4/actions.htm
http://edn.embarcadero.com/article/27058
http://forum.lazarus.freepascal.org/index.php?topic=17001.0
http://wiki.freepascal.org/TActionList
http://wiki.freepascal.org/TAction
http://wiki.freepascal.org/Lazarus_Components
http://wiki.freepascal.org/Current_conversion_projects
2
General / Re: Assign functions to dynamic objects
« Last post by ASBzone on Today at 05:49:00 am »
OffTopic: A game of life (https://bitstorm.org/gameoflife/) where the user can put permanent blocks, teletransport holes, multipliers... the posibilites are almost infinite. Sadly im now in 2 different projects.

I loved that game.  Years ago, I did that game in Pascal.  I have no idea where the source code is, and I think I will do it again.
3
General / Translation from Python to Lazarus
« Last post by mpknap on Today at 05:30:33 am »
I have a request. The following code sends the file to the server. The main project is in Python, I do not know this programming environment. I do not know JSON. Anyone can write this in Lazarus Pascal for windows?



Code: Pascal  [Select]
  1. import_ requests
  2. import_ json
  3. import_ time
  4. import_ base64
  5. import_ urllib3
  6.  
  7. urllib3.disable_warnings()
  8. picture = open('test4.png', 'rb') # read picture
  9. picture_read = picture.read()
  10. base64_picture = base64.b64encode(picture_read) # save picture as  base 64
  11. print(len((str(base64_picture)[2:]))) # cutting off the first two characters from byte encoding, you may not need to
  12. linux_time = time.time()
  13. linux_time_millisecund = [item for item in str(linux_time) if item != '.'] # formatting time according to the linux era
  14.  
  15. # Below you have two variables in the form of a dictionary, which are protocols for logging in and sending data, this is what I sent you
  16. earlier and comes from the creed page (with minor changes)
  17.  
  18. # data in the login in addition to the password and e-mail are free, if you registered a cell phone it will match.
  19.  
  20. login = {'app_version': '1', 'device_model': 'zero', 'device_type': 'raspberry','system_version': 'raspbian',
  21. 'device_id': 'raspberry','password': 'hasło', "email": "email"}
  22.  
  23.  
  24. # in detection the data in addition to frame content and timestamp are also arbitrary, remember to limit the linux time to 13 characters as on the server,
  25. otherwise you will have problems with the date.
  26.  
  27. detection = {"detections": [{"frame_content": '%s'% (str(base64_picture)[2:]), "timestamp": int(''.join(linux_time_millisecund)[:-4]), "latitude": 51.708491,
  28. "longitude": 19.476362, "altitude": 12, "accuracy": 1, "provider": 'google map', "width": 45, "height": 45, "id": 1}],
  29. "device_id": "raspberry", "androidVersion": 'none', "device_model": "zero", "app_version": '1',
  30. "system_version": 'raspbian', "device_type": 'raspberry'}
  31.  
  32. # Once I've created variables, I save them in the json format.
  33.  
  34. with open("login.json", "w") as login_file:
  35.    json.dump(login, login_file)
  36. with open("login.json", "r") as read_login:
  37.    data_login = json.load(read_login)
  38.  
  39. with open("detection.json", "w") as detection_file:
  40.    json.dump(detection, detection_file)
  41. with open("detection.json", "r") as read_detection:
  42.    data_detetion = json.load(read_detection)
  43.  
  44. #request login is to get the authentication token needed to send the image to the server
  45.  
  46. request_login = requests.post('https://api.credo.science/api/v2/user/login', verify=False, json=data_login)
  47. print(request_login.status_code, request_login.reason)
  48. token = request_login.json()['token']
  49.  
  50. #in request detection you are sending a json file and a token code, and that's all, the file is on the server
  51.  
  52. request_detection = requests.post('https://api.credo.science/api/v2/detection', verify=False,
  53.                                   json=data_detetion, headers={'Authorization': 'Token %s' % token})
  54. print(request_detection.status_code, request_detection.reason)
  55. print(request_detection.content)
  56.  
4
FPSpreadsheet / Re: user define function
« Last post by kjteng on Today at 04:21:26 am »
Thanks for the info. Congratulation.
5
RichMemo / Re: TRichMemo example for attributes via Keystroke?
« Last post by skalogryz on Today at 03:47:58 am »
If I set RichMemo1.Font.Style += [fsBold] it is bold, when I disable it, everything I typed is unbold.
don't. Assigning Font to richmemo changes the whole text to the specified font.
instead you could use code like this:
Code: Pascal  [Select]
  1. var
  2.   fn : TFontParams;
  3. begin
  4.   RichMemo1.GetTextAttributes(RichMemo1.SelStart, fn);
  5.   fn.Style:=fn.Style+[fsBold];
  6.   RichMemo1.SetTextAttributes(RichMemo1.SelStart, 0, fn);
  7. end;
  8.  

Working on an Email like client
RichMemo is not suitable for the task. The reason is simple - no support for embedding images.
6
RichMemo / TRichMemo example for attributes via Keystroke?
« Last post by ozznixon on Today at 01:40:00 am »
I am able to highlight words, CTRL-B, and viola, Bold wording... however, if I Clear the RichMemo, Ctrl-B, and start typing - it is not bold. If I set RichMemo1.Font.Style += [fsBold] it is bold, when I disable it, everything I typed is unbold.

I copied and applied Rich2xxx's Set Attribute code, it does the same - selections change, but, to do on the fly from keyboard (or via buttons that contain the same code) nada.

Is there an example of using Keyboard and Buttons to toggle attributes where SelLength == 0?

Also, i have downloaded 3 different RTF2HTML pascal units, none work with TRichMemo's RTF output. Does anyone have a SaveToHTML and LoadFromHTML for TRichMemo? Working on an Email like client - and the other end is dCEF based - so I have to send/receive HTML from their product.

PS. My app runs on Linux and Mac, so I cannot use all these Windows tricks.  >:D

Regards,
Ozz
7
Third party / Re: TGIFViewer component
« Last post by wp on Today at 01:15:01 am »
My problem is that you seem to stuff too much unrelated material into the gifviewer package which is not absolutely needed or which could have more general use.

What do you want?

Provide a gifviewer? Then the units
- gvTranslate (similar stuff is in LCLTranslator)
- Typeshelpers (large overlap with type-helpers built into fpc now)
- and probably even uFastBitmap (because I am rather sure that you can paint the gif also with the routines of fcl-image)
are not needed.

Or do you want to provide a general-purpose package with translation utils, fast bitmap, additional type helpers and - of course - gif viewer? Then you should name the package differently and emphasize its multi-use character.

A few other comments:
  • I see two .po files in your locale folder. Translaters don't like this. Usually they prefer a single po file per package.
  • Did you know that, unlike Delphi, fpc already has built-in gif support (unit fpreadgif in source folder packages/fp-image/src of the fpc installation)? I did not compare, but I am rather sure that there is a lot of overlap with your unit. Why write the same again when it's already there?
Please don't misunderstand these critical word - I really think your units are great work.
8
Third party / Re: TwilioLib - Send SMS from Freepascal
« Last post by Trenatos on Today at 12:31:43 am »
Thanks for the feedback Xor-el!

I've updated the unit and example, would you mind taking a look again?
9
Third party / Re: TGIFViewer component
« Last post by BeanzMaster on Today at 12:09:28 am »
Why do you introduce a new translation system here? Lazarus has good built-in translation support, you only must activate the i18n option and define a language folder in the package settings, as well as declare the message strings as resource strings.

Hi, it's not a new translation system. TGVTranslate it's just an helper. The i18n is activated but if i well understand it an application for example if i want have tanslation in french of lcl the po (lclstrconsts.fr.po in this case)  must be place in a subfolder of the application name "languages" after for loading just use
Code: Pascal  [Select]
  1. Translations.TranslateUnitResourceStrings('LCLStrConsts', LF);
where LF is the path where is po files. But perhaps i'm not understanding well on how to translate an application correctly. I like the possibility to change languages dynamically for testing. Translating french to english or vice-versa can occurs some problems in IHM due to the length of string. French sentence are often longer.

I'm open for all advices and suggestions

Notes : I've tested under Mac and  it doesn't work. I've a bug with folder settings. Don't say why. But i think i must add something in the bundle for make it work.

10
FPSpreadsheet / Re: user define function
« Last post by wp on Today at 12:04:24 am »
I accidentally keyed in an invalid formula (=BB)  into a cell say A1 of sheet3, an error message pop up (see e1.png attached) and the invlaid formula would not be shown in the worksheet.

After that, whenever I key in something to the worksheet (in any cell), I will get the same error message.

However, if i key in a valid 3D formula in cell A1 eg Sheet1!B12, the worksheet would be back to normal (error message wont popup anymore).
This is hard stuff. I tried several approaches, but none of them worked out, mostly things are even getting worse...
Maybe I've got an operating solution now - it based on the old Borland article https://community.embarcadero.com/article/technical-articles/149-tools/12766-validating-input-in-tedit-components and looks ok to me. Now it is no longer possible to exit the CellEdit or edited WorksheetGrid cell while an entered formula is not valid.
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