-
Content Count
2998 -
Joined
-
Last visited
-
Days Won
135
Everything posted by Remy Lebeau
-
Obviously, you need to adjust the code for your particular setup, which you did not provide ANY details about, so I could only give you a GENERAL solution. What kind of database are you are trying to access? What component(s) are you are using to access that database? My example was meant to represent whatever Query component you are actually using on your Form, such as a TQuery, TFDQuery, etc. Use whatever the actual component name really is. Not a String variable. Have you read Delphi's documentation on working with Databases? There are whole books on this subject.
-
Yes, I see the same issue happen, the top of the Recent menu is WAY off screen:
-
There should be no difference between setting up a query at design-time vs runtime. So, what are you REALLY having trouble with, exactly? Can you show the actual code that you are having trouble with? All you need is something like this: Query.SQL.Text := 'SELECT Name, OtherFieldsAsNeeded from dino where Name = :PName'; Query.ParamByName('PName').AsString := sName; Query.Open; edtName.Text := Query.FieldByName('Name').AsString;
-
No, I was actually referring to the compiler's Library and Browsing Paths, the debugger's Source Path, etc. There are multiple search paths in a project, make sure none of them are referring to Indy's source folder during compiling. You don't want the compiler finding Indy's source code if you want to use the pre-installed version. You said you re-installed the IDE and transferred over old projects. Do you have the same problem if you start a new project fresh? What IDE version were the old projects written in? It is generally a good idea to create a new project in the new IDE and then add your existing source files to the new project as needed, rather than just open an old project in the new IDE.
-
Is there more to the error message? I would think it would tell you WHY it can't compile the unit. In any case, it sounds like the project is trying to recompile Indy from its source code. Does the project refer to Indy's source code folder directly? It shouldn't, so if it does then remove that folder from the project's search directories. The project should only be using the pre-installed unit/package binaries that were already compiled for the IDE.
-
Assigning custom colors to properties via code at runtime is trivial, as shown earlier. But if you want to choose custom colors at design-time, that is possible but not trivial, as you have to write your own custom property editor and register it for TColor, overriding the default property editor. See webcolors and custom colors in Delphi's Object Inspector colorpicker at design-time Custom colors in Delphi 7
-
Profile - currently no entry Delphi 12
Remy Lebeau replied to Brian Evans's topic in Community Management
There is now. -
It has been added. Oddly, it is listed as just "Delphi 12" instead of as "Delphi 12 Athens".
-
Delphi 12: Install Packages inconsistency?
Remy Lebeau replied to PeterPanettone's topic in Delphi IDE and APIs
Sure, but I shouldn't really have to go to that much trouble in the first place just to get basic behavior. -
And RandomFrom()
-
RandomRange() has been around since Delphi 6.
-
Can you be a little more specific? What are the full error messages? Are you trying to use the version of Indy that ships preinstalled with the IDE (it should "just work" out of the box), or did you replace it with a newer version of Indy?
-
One option would be to create 4 lists and fill them with the possible numbers, and then generate a random index for each list, where you remove each found number from subsequent lists before generating indexes for them. For example: var values1, values2, values3, values4: TList<Integer>; value1, value2, value3, value4, index: Integer; procedure populate(list: TList<Integer>; startValue, endValue: Integer); var value: Integer; begin list.Capacity := endValue - startValue + 1; for value := startValue to endValue do list.Add(value); end; procedure checkAndRemove(list: TList<Integer>; startValue, endValue, valueToRemove: Integer); begin if (valueToRemove >= startValue) and (valueToRemove <= endValue) then list.Remove(valueToRemove); end; begin values1 := TList<Integer>.Create; values2 := TList<Integer>.Create; values3 := TList<Integer>.Create; values4 := TList<Integer>.Create; populate(values1, 1, 300); populate(values2, 100, 550); populate(values3, 250, 750); populate(values4, 500, 1000); index := random(values1.Count); value1 := values1[index]; checkAndRemove(values2, 100, 550, value1); checkAndRemove(values3, 250, 750, value1); checkAndRemove(values4, 500, 1000, value1); index := random(values2.Count); value2 := values2[index]; checkAndRemove(values3, 250, 750, value2); checkAndRemove(values4, 500, 1000, value2); index := random(values3.Count); value3 := values3[index]; checkAndRemove(values4, 500, 1000, value3); index := random(values4.Count); value4 := values4[index]; values1.Free; values2.Free; values3.Free; values4.Free; end;
-
How to remove C++ from RadStudio 12 after installation?
Remy Lebeau replied to Bart Kindt's topic in VCL
Perhaps run $(BDS)\bin\LicenseManager.exe and remove your beta license if it's still listed? -
Delphi 12: Install Packages inconsistency?
Remy Lebeau replied to PeterPanettone's topic in Delphi IDE and APIs
Agreed! Something that is really annoying me since installing 12.0 is when I double-click on a .pas/.cpp file outside of the IDE, and the IDE is not running yet, the IDE is started, but it wastes time loading all of its default packages and layouts, and then opens the .pas/.cpp file, and then finally goes to the Welcome screen instead of the .pas/.cpp file. Loading the packages, the Structure view, the Palette, etc is all completely unnecessary and the Welcome screen is completely unwelcomed when I just want to view a file. I expect the IDE to basically just present me with the code editor and nothing else. If I want the full IDE experience, I'll open the full IDE myself, or at least open/create a project and expect the IDE to (re)load everything it needs to support that task. -
Better to use CompilerVersion (and RTLVersion) instead, then you don't need to update the defines every time a new version is released, only when you need to add a new define, eg: {$IF DEFINED(DCC) OR (CompilerVersion < 23)} {$DEFINE EC_DELPHI} {$IFEND} {$IF CompilerVersion >= 20} // Delphi 2009 {$DEFINE EC_UNICODE} {$IFEND} {$IF CompilerVersion >= 34} // Delphi 10.4 {$IF CompilerVersion < 35} {$DEFINE EC_VCL27} {$IFEND} {$DEFINE EC_VCL27_UP} {$IFEND} {$IF CompilerVersion >= 36} // Delphi 12 ... {$IFEND}
-
Then you are likely doing too much work in your drawing code. Or you are doing other things besides just drawing. Painting should be a quick task. Draw only what can be seen for the current state of your existing data, nothing more. Do not manage your data/UI in any way other than drawing. If you need to manipulate your data/UI, that has to be done outside of a paint cycle. That is not how UI painting works. You have to draw whatever your current state represents. After the painting is finished, if a state change occurs, then you can trigger a repaint to draw the updated state. No. Every paint cycle is a complete redraw from scratch. For each window/control that is being painted, you have to draw it entirely in a single cycle. And then again in the next cycle. And so on. You can Invalidate() an individual form/control to trigger a new paint cycle for it, but that requires you to redraw it entirely from scratch when that next cycle begins,
-
How to enable SafeSEH, CFG flags for Delphi 10.4 Dll's/Exe's?
Remy Lebeau replied to raj_delphi's topic in General Help
SafeSEH and CFG require compiler/linker support to setup additional data/code in the exe, so it's not enough to just enable their flags in the PE header. Delphi does not support SafeSEH or CFG at this time. But there is a SetProcessValidCallTargets() API you can call in your own code to implement CFG manually, at least. -
Ugrading Indy on Delphi 11. Error: F2051 Unit IdThread was compiled with a different version of IdGlobal.IdDisposeAndNil
Remy Lebeau replied to PeaShooter_OMO's topic in Indy
I don't really have an answer for you. All I can think of right now is either 1) maybe you still have old files on your system somewhere, or 2) maybe you didn't recompile/separate everything when switching between release and debug builds. -
REMOVE 'TfrmDatabaseTutorial.' from the DECLARATION! public { Public declarations } procedure ShowSelectResults; // <-- NO TfrmDatabaseTutorial here! end; It belongs only in the IMPLEMENTATION: procedure TfrmDatabaseTutorial.ShowSelectResults; // <-- ONLY here! var headline : TStringList; ... end;
-
Do you NEED to recompile the IPPeerAPI abstraction layer, though? Are you actually using any Embarcadero techs (DataSnap, etc) that are affected by updating the main Indy library?
-
Can't you just update the declaration of TPasswordEventPeer in IPPeerAPI.pas? FYI, at some point in a later version, Embarcadero changed TPasswordEventPeer again, to use TStringBuilder instead of String (why? I have no idea!).
-
If the '<...>' is always at end of the string then you could just SetLength() the string to truncate it, eg: Result := MyString; StartPos := Pos('<', Result); if StartPos > 0 then begin SetLength(Result, StartPos - 1); Result := TrimRight(Result); end;
-
No. Indy does not operate at the ethernet layer, so it has no need for MAC addresses. You will have to use platform-specific APIs, like GetAdaptersInfo()/GetAdaptersAddresses() on Windows, getifaddrs() on Posix, etc to get that kind of information directly from the OS.
-
Minor nitpick - you should pass in StartPos as a 3rd parameter to the 2nd Pos() call: Delete(Result, StartPos, Pos('>', Result, StartPos+1) - StartPos + 1) You might also want to Trim/Right() the Result after deleting the characters.