-
Content Count
321 -
Joined
-
Last visited
-
Days Won
3
Everything posted by shineworld
-
Hi to all. I've yet a lot of D2006 projects that I will not move to Sydney. All of them use Indy 9 as the default installed library. For one project I would like to move to Indy10. In this project, all Indy objects/class will be created at code level (none reference in DFMs). There is a way to keep Indy 9 libraries in the IDE system BUT only for this project use Indy10 sources (for example embedding Indy10 in project sources ) ? Thank you in advance for your replies!
-
At this point, the last question. Where I can find the latest version of Indy10 compatible with BDS2006? I guess that Indy10 in BDS is very very old 🙂
-
Hi all. I'm moving a big project from D2006 to Sydney. Required changes are very few after few changes in the original sources D2006 files so I can maintain either version. Why that? D2006 is a killer, all work perfectly and well tested. I can't say this for Sydney which crashes often, overall during debug. The reason to move is to add support of Unicode. The program still remains a 32-bit application. But there is a problem. With source code and very few $DEFINE, I can manage the differences and keep a clean source code. With DFM, unfortunately, I've found some differences, for example in TLabel. In BDS2006 the TLabel is for default Transparent = False so for any DFM there is not this property value. In Sydney, the TLabel is for default Transparent = True so the resulting View is very UGLY and needs to manually fix every time. Other object's properties are different. How to solve this incompatibility? There is a document that describes differences? There is a tool to automate the conversions? I have about 30 views and 40 frames with related DFM...
-
I guess to re-engineering the software after conversion is finished, using templates, more frames to common UI parts... I was in doubt to move software from D2006 to XE some years ago, then to Rio, and now to Sydney. D2006 is a killer environment, with very very few issues, robust and every EXE produced is working without oddities or bugs. When tried XE I've found a lot of IDE bugs, crashes, etc. Same with Rio and unfortunately also with Sydney which crashes often during development. At this point, I need to move to a UNICODE tool, and overall update a lot of used 3rd party libraries that are very old and not keep steps of time. In these years I have always purchased the outgoing Delphi versions but never used them... When a thing works why change? was the mainline thought.
-
In D2006 DoubleBuffered is always set to False by default. Switching between TabSheet there is an ugly flashing paint (for eg). I've set programmatically the interesting fields to use DoubleBuffered and flash disappears. I find it bad to program some properties directly on form objects (there are hundreds of objects in a configuration panel someone can be missed). Also events managers, OnClick, Onxxx, are programmatically added to edit fields, and so on. My code is a mix of form designer results and code to simplify the design part.
-
I've made an UGLY program to open programmatically the DFM and apply changes to TLabel, TPanel, and other objects that changes defaults with some fixed rules linked to my way to design form and seem to works. The UI result is good, also in grids and panels which was been unviewable before. Now all works as aspected! Thank you for your suggestions!
-
Frames don't use yet a common ancestor... This is a very old project grown a lot in years and suffers from my ignorance about Delphi framework features. Initially converted from an old VB6 program. I've tried the in-code solution and works. I already walk the form components in FormCreate to define some properties. Is ugly, because in view DFM is yet wrong, but during run works. // sets access levels grid AccessLevelsGrid.RowCount := 1 + FSettings.AccessLevelManager.Count; AccessLevelsGrid.DoubleBuffered := True; // assigns run-time events RVSpectraFrame.OnChange := WavelengthChange; RZSpectraFrame.OnChange := WavelengthChange; // sets components double buffered & transparent C := ComponentCount - 1; for I := 0 to C do begin Component := Components[I]; if Component is TCheckBox then begin TCheckBox(Component).DoubleBuffered := True; Continue; end; if Component is TComboBox then begin TComboBox(Component).DoubleBuffered := True; Continue; end; if Component is TEdit then begin TEdit(Component).DoubleBuffered := True; Continue; end; if Component is TPanel then begin TPanel(Component).DoubleBuffered := True; Continue; end; if Component is TTabSheet then begin TTabSheet(Component).DoubleBuffered := True; Continue; end; {$IFDEF VER340} if Component is TLabel then begin TLabel(Component).Transparent := False; Continue; end; {$ENDIF} end; // sets custom descriptions grid elements UserInputDescriptions.RowCount := I_O.MAX_DIGITAL_INPUTS + 1; UserOutputDescriptions.RowCount := I_O.MAX_DIGITAL_OUTPUTS + 1; AnalogInputDescriptions.RowCount := I_O.MAX_ANALOG_INPUTS + 1; AnalogOutputDescriptions.RowCount := I_O.MAX_ANALOG_OUTPUTS + 1; I will try with the Interposer class way...
-
Quickly zero all local variables?
shineworld replied to A.M. Hoornweg's topic in RTL and Delphi Object Pascal
I'm used to placing a procedure Init in any record so is simple to set defaults according to data types of records. PCompileArguments = ^TCompileArguments; TCompileArguments = record Mode: TCompileMode; Code: string; X: Extended; Y: Extended; Z: Extended; A: Extended; B: Extended; C: Extended; ToolPathMode: TToolPathMode; Line: Cardinal; FirstCmdId: Cardinal; LastLine: Cardinal; LastCmdId: Cardinal; procedure Assign(Source: PCompileArguments); overload; procedure Assign(Source: TCompileArguments); overload; procedure Init; overload; procedure Init(Mode: TCompileMode; const Code: string; X, Y, Z, A, B, C: Extended; ToolPathMode: TToolPathMode; Line, FirstCmdId, LastLine, LastCmdId: Cardinal); overload; function LoadFromMemento(Memento: IMemento): Boolean; function SaveToMemento(Memento: IMemento): Boolean; end; -
Hi all. I'm getting crazy with old software (Delphi 2006) port to Sydney about AnsiPos of an AnsiString: function TTCPBin01.GetTargetAnswer: AnsiString; begin Result := FTargetAnswer; end; .. .. if AnsiPos('?y', GetTargetAnswer) <> 0 then begin FErrorCode := sigc_None; FErrorMessage := SignalMessage(FErrorCode); Result := qmct_Prog; end GetTargetAnswer return an AnsiString. Also using AnsiPos to check for a substring in the resulting string the compiler notice me: [dcc32 Warning] osTCPBin01.pas(224): W1057 Implicit string cast from 'AnsiString' to 'string'. Placing the mouse cursor on AnsiPos the HINT some time notice me: function (const SubStr: string; const S: string): Integer; Other times notice me: function (const SubStr: AnsiString; const S: AnsiString): Integer; In either case however the compiler notice Implicit cast... Have you any suggestion about? Best regards Silverio Diquigiovanni
-
You are right! I will move all to arrays of bytes. Unfortunately, a lot of old functions assumed a string as an array of chars sometimes cast to bytes. I need to change the entire set of them, it's the only valid solution.
-
I've moved almost all software from (Ansi)string of BDS2006 to string of Sydney. This is a little part of TCP connection to our embedded boards which uses old (Ansi)string and I just would to keep it as is, because works and is a little bit complicated; access to return strings as array of bytes for many algorithms (crypt, compressing, CRC, hashing, etc.).
-
Hi all, I'm used with git and take updated 3rd parties repositories. With Sydney I've begun to use GetIt, for eg. with SynEdit. How Getit is supposed to manage the updates ? Looking at the Getit web page synedit is update to 20 december. In my Getit syndey page the date is previous september. Catalog repositories don't have git so I need to uninstall and reinstall the packegs with Getit ?
-
Compute nearest color
shineworld replied to FPiette's topic in Algorithms, Data Structures and Class Design
If you can define a palette of accepted colors you can check the color closer to one of the palette. In past, I've made a program with fixed palette colors and I need to import PNG or other formats and convert them to a palletized bmp. Attached a very old pas file, used in a Borland Builder C++ 3.0, that I've used to reduce any color to a palletized color. Function RecuceColors. Is very old however... my caller: Graphics::TBitmap* __fastcall QImageManager::CreateBitmapPaletteFromBitmap24BPP(Graphics::TBitmap* Bitmap) { if (FPalette != NULL && FPalette->ColorCount != 0) { // creates paletted bitmap Graphics::TBitmap* BitmapPalette = ReduceColors ( Bitmap, rmPalette, dmNearest, FPalette->ColorBits, FPalette->HPalette ); return BitmapPalette; } else return NULL; } ColorFunctions.pas -
Security - How freaky can you get!
shineworld replied to Clément's topic in Algorithms, Data Structures and Class Design
Oh, world.... I don't know about that... I'm a little bit angrier now. The HASP keys aren't cheap at all (we spend more than $50 each dongle)... 90% of our software is freeware because made for specific hardware to work (we sell hardware, not software). But 10% (customer-specific programs) use HASP dongle to recover a minimal part of development costs... -
Security - How freaky can you get!
shineworld replied to Clément's topic in Algorithms, Data Structures and Class Design
- Never keep passwords in strings (use raw bytes arrays coding them with hashes). - Where possible I use Sentinel HASP Keys and related software protections. - Reduce the amount of UI used in DFM (sometimes I prefer to create UI with code). - Could help a little to use UPX packer compressor so not GURU can't have simple access to DFM contents with resource viewers. - Some tools, as MadExpect, add CRC exe integrity test (you can add system custom system to check exe integrity). - Deploy custom exe with final customer info encrypted (so you can know where start the fall). - Don't place security checks in only a unit but be creative 🙂 -
Hi all, I'm trying to de-couple the actions lists, with related actions, from a specific form to a data module. These actions will be used so also in other views without duplicate them in every form. The things work BUT they are not cyclic updated. The OnActionUpdate is called only when I click on the assigned graphic button (for example), but I would like that ActionXXX.Enabled si cyclically called as when they are in a form. Some ideas? Best Regards Silverio
-
Thanks for the info, very usefull! I've already fought a lot (a couple of weeks) with ANSI string used often, in the old 2007 project, as byte storage media (communications, crypt algorithms, data storage, etc). The use of string (AnsiString) was fine and simple but now had required a lot of checks and changes to work fine and moved to TByteArray or similar classes. The reasons to move the project to Syndey (or Rio, I've also that) are: - Memory - Unicode support - More updated 3rd parties libraries (as well as GLScene, etc). - Gestures support Memory I already use FastMM to extend at maximum 32-bit capabilities. SynEdit (ansi version) becomes critical when reaches more than 8 million g-code lines (G-Code is the language of CNC). With FastMM I can reach more than 15 million g-code lines in the same 32-bit OS. OpenGL graphics also eat a lot of memory (internal data of GLSCene). With 64 bit available memory should not be a problem to have more memory for the process and threads. Also the g-code language compiler is hungry for memory. {$INCLUDE Settings.inc} // TAKE CARE: If in the project there is an uses of IdComponent this add a critical section in initialization section // which will not be delete in finalization code signing for a Critical Section Leak. Don't care about this // leak because is wanted by Indy designers. Follow the note in IdComponent.pas: // // initialization // GStackCriticalSection := TCriticalSection.Create; // finalization // // Dont Free. If shutdown is from another Init section, it can cause GPF when stack // // tries to access it. App will kill it off anyways, so just let it leak // // FreeAndNil(GStackCriticalSection); // Use this CODE-CHUNK to restore automatically removed, by Project -> Add/Remove..., FastMM uses declaration // // {$IFDEF USES_EMBEDDED_FASTMM_MEMORY_MANAGER} // {$SetPEFlags $20} // {$DEFINE USES_FASTMM} // FastMM4 in 'sources\extra\FastMM4\FastMM4.pas', // FastMM4Messages in 'sources\extra\FastMM4\FastMM4Messages.pas', // {$ENDIF} uses {$IFDEF USES_EMBEDDED_FASTMM_MEMORY_MANAGER} {$SetPEFlags $20} {$DEFINE USES_FASTMM} FastMM4 in 'sources\extra\FastMM4\FastMM4.pas', FastMM4Messages in 'sources\extra\FastMM4\FastMM4Messages.pas', {$ENDIF} Unicode support Market increase and need to support not ANSI languages has come. I already use dxgettext and .po files (I've modified the gnugettext.pas to work fine with Rio and Sydney). More updated 3rd parties libraries (as well as GLScene, etc) GLScene is an incredible OpenGL environment and is grown a lot in recent years. Unfortunately, the latest compatible version with 2007 is old, very old and missing a lot of interesting things. I need to move to it 🙂 Gesture support I would like to fully support the touch screens with gestures management.
-
Thanks for the suggestion, I never thought about this option. I'm an old Delphi programmer (from the first version) but I've increased in lines code and sometimes I've missed the good code planning. At moment I'm trying to port a project from Delphi 2007 to Sydney. There are about 1.300.000 code lines a lot of 3th parties libraries (someone to substitute because incompatible with Sydney). Just a sample of the project (all native Delphi code here ):
-
Thanks to all for the support. I guess to have understood the actions on a data module when linked to the GUI object at design time, and when programmatically linked to run-time created frames and objects. I've just added an override to IsShortCut in TForm to propagate shortcuts from actions. actionsinmodule.zip
-
Hi all, I'm moving a big project, about 1.500.000 code lines from Delphi 2006 to Syndey, but I'm in trouble with how Syndey destroys objects in program termination. Sample: A very Dummy application with 1 form without any other code than a comment in TForm3.FormDestory to place a breakpoint: unit Unit3; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs; type TForm3 = class(TForm) procedure FormDestroy(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form3: TForm3; implementation {$R *.dfm} procedure TForm3.FormDestroy(Sender: TObject); begin // < placed breakpoint here!!! // end; end. A very simple project with a string assignment to catch the main flow (in S := ''; ) after Application Run: program Project2; uses Vcl.Forms, Unit3 in 'Unit3.pas' {Form3}; {$R *.res} var S: string; begin S := 'asdfasdf'; Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TForm3, Form3); Application.Run; S := ''; ; << placed break point here end. In BDS 2006 if I run this code and exit program first break at Form3.FormDestroy, then breaks in main at S := ''. RIGHT ! In Sydney first, break in the main at S := '', then goes to Form3.FormDestry. What has changed so much the Delphi behavior? if I add a Form3.DoubleClick event with Application.Terminate I got also an environment error: [50164E97]{rtl270.bpl } System.Classes.TList.Get (Line 4972, "System.Classes.pas" + 2) + $A [50EBFC4B]{vcl270.bpl } Vcl.AppEvnts.TMultiCaster.GetAppEvents (Line 657, "Vcl.AppEvnts.pas" + 1) + $B [50EBF60E]{vcl270.bpl } Vcl.AppEvnts.TMultiCaster.DoActivate (Line 425, "Vcl.AppEvnts.pas" + 5) + $9 [50E5A73F]{vcl270.bpl } Vcl.Forms.TApplication.WndProc (Line 10617, "Vcl.Forms.pas" + 126) + $C [50181450]{rtl270.bpl } System.Classes.StdWndProc (Line 18021, "System.Classes.pas" + 😎 + $0 [50E5B23F]{vcl270.bpl } Vcl.Forms.TApplication.ProcessMessage (Line 11028, "Vcl.Forms.pas" + 23) + $1 [50E5B282]{vcl270.bpl } Vcl.Forms.TApplication.HandleMessage (Line 11058, "Vcl.Forms.pas" + 1) + $4 [50E5B5B5]{vcl270.bpl } Vcl.Forms.TApplication.Run (Line 11196, "Vcl.Forms.pas" + 26) + $3 [0051E178]{bds.exe } bds.bds (Line 222, "" + 13) + $2 😞 test.7z
-
I hereby want to thank all of you for the answers. I misunderstood the mechanism of creating and destroying objects in Delphi, especially when forms are destroyed. So far the code has worked but only because an unclosed thread changed the cards in play. Thank you AGAIN for your time!
-
@Remy Lebeau you are right, just had to do with my project which is not good structured and something happens in the phase of destroying objects (I guess because I'm waiting for some thread stops). I've to change where objects are created and how they are freed. Surely I've mistake some important thing 🙂 https://youtu.be/MNppXiVvDZI
-
You are right, I've checked again with an empty program in BDS2006 and worked as you had suggested. But if I debug my big program the behavior is different, so there something that has changed the rules in my code! I need to check it... Thank you for the suggestion about AddExitProc(DoOnExit); // Put this line before Application.Run I don't know it before...