

eivindbakkestuen
Members-
Content Count
114 -
Joined
-
Last visited
-
Days Won
7
eivindbakkestuen last won the day on March 22
eivindbakkestuen had the most liked content!
Community Reputation
55 ExcellentRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
xaml island Ask if Embarcadero will integrate UWP & WinUI in comming Version of Radstudio
eivindbakkestuen replied to bravesofts's topic in Windows API
The above posts make a perfect case for why Ctrl+B should be used sparingly. -
NexusDB components are now available in the new 64 bit IDE 👍 v4.7514 adds - 64 bit Designtime Support - Replication (Beta) Find the best Delphi Database at NexusDB
-
function declarations without ; at the end
eivindbakkestuen replied to Günther Schoch's topic in RTL and Delphi Object Pascal
Best guess, with a bug report, Emb will fix the pascal unit, but not change the compiler. But it needs to be logged first, no need to ask anybody 🙂 -
function declarations without ; at the end
eivindbakkestuen replied to Günther Schoch's topic in RTL and Delphi Object Pascal
Good question 🙂 There exists no official language definition, the closest you get if you ask is "whatever the compiler accepts". However, examples in "function" declaration documentation all end with ";" so the above missing semicolons would be a compiler anomaly. Report it, and Emb can at least fix the missing characters. 🙂 -
Google OAuth2, "username and password not accepted" when sending
eivindbakkestuen replied to emileverh's topic in Network, Cloud and Web
We can't see your screen, or your code... -
Probably the printer was offline or unreachable before; and then it was reachable. This happens every day here when trying to print from many, even well known applications; they take forever to time out if the default printer wasn't turned on. You could try using a worker thread for printing, then your application doesn't freeze and you have some control over what happens
-
It is a documentation omission, the help on the link states "You can only rely on the final value of a for loop control variable if the loop is left with a goto or exit statement. " In https://docwiki.embarcadero.com/RADStudio/Athens/en/Declarations_and_Statements_(Delphi)#For_Statements it says "After the for statement terminates (provided this was not forced by a Break or an Exit procedure), the value of counter is undefined. " The value should be defined, as the loop here exits with a Break,
-
Use a separate "master" thread to call WaitForAll. Are you already using TThread.Synchronize for the memo updates?
-
If your application has bugs, sure...
-
What problem are you trying to solve?
-
CreateComponent() equivalent for non-component classes?
eivindbakkestuen posted a topic in Python4Delphi
Using the WrapDelphi and associated classes, I have probably missed it, but I couldn't see an equivalent to the CreateComponent() method to create non-TComponent descendant classes, eg TStringList etc which I needed for things in the .PY script below. Is there an existing way of creating such classes on the fly in the .PY script? ... db = CreateComponent("TnxDatabase", None) sl = TStringList (?) db.GetTableList(sl) print(*sl) ... I added the following method and registered it, and now I can do sl = CreateClass("TStringList", None) and it works. If there's no such built in method, feel free to assimilate this method into the WrapDelphi unit. 🙂 function TPyDelphiWrapper.CreateClass(pself, args: PPyObject): PPyObject; // Exposed function at the Module level // CreateClass(ClassName, Owner) var KlassName : PAnsiChar; _obj : PPyObject; Klass : TClass; _comp : TObject; TheClass : TObject; Ownership : TObjectOwnership; begin Result := nil; CheckEngine; with Engine do begin if PyArg_ParseTuple( args, 'sO:CreateDelphiClass', @KlassName, @_obj ) <> 0 then begin try Klass := GetClass(string(KlassName)); except Klass := nil; end; if (Klass = nil) or not Klass.InheritsFrom(TObject) then begin PyErr_SetString(PyExc_TypeError^, PAnsiChar(EncodeString( Format(rs_ErrInvalidArgs, ['CreateClass', rs_InvalidClass])))); Exit; end; TheClass := TClass(Klass).Create; Ownership := soOwned; Result := Self.Wrap(TheClass, Ownership); end else PyErr_SetString(PyExc_TypeError^, PAnsiChar(EncodeString( Format(rs_ErrInvalidArgs, ['CreateClass', ''])))); end; end; -
How to release memory used by exceptions?
eivindbakkestuen replied to eivindbakkestuen's topic in Python4Delphi
Thanks a million! With the latest version, I no longer see the memory leak. -
I'm using the WrapDelphi unit in a project, so that the TPyDelphiWrapper.CreateComponent function can be available from a Python script. Now, a clever user has come up with a "smart" way of finding available classes; namely, iterate over every possible string of characters and feed the strings into CreateComponent() in the Python script, and catch exceptions raised when the classname doesn't exist. Yes, due to the exponential nature of the search as the strings get longer, its not really a good way of finding long classnames. However, the problem I'm being presented with is that memory runs out long before time does. I have narrowed the problem down to the following (commented out by me for test) PyErr_SetObject call in TPyDelphiWrapper.CreateComponent(). if (Klass = nil) or not Klass.InheritsFrom(TComponent) then begin // PyErr_SetObject(PyExc_TypeError^, PyUnicodeFromString( // Format(rs_ErrInvalidArgs, // ['CreateComponent', rs_InvalidClass]))); Exit; end; The inner function in the Python script is the following. My question is, is there something different that needs to be called from the Python script, in order to release memory used by the exception? def typename(k, prefix="T", ab=alphabet): try: w = prefix + int2word(k, ab=ab) t = CreateComponent(w, None) out = ["T" + type(t).__name__] t.Free() del t except: out = [] return out
-
Grep results panel displays source code or form designer
eivindbakkestuen posted a topic in GExperts
Having just installed Delphi 12.2, I'm seeing something I've not seen before. I have the grep results panel docked on the right with the project manager etc; somehow it is now displaying content matching the form designer, or the source editor, switching with each F12 press. Anyone else seen anything like this? I'm not sure exactly what I did to trigger it, and it didn't happen again after restarting the IDE. -
Datafaction = DaAbort still shows the error message?
eivindbakkestuen replied to alogrep's topic in VCL
Notice the "Post" part? I'm guessing the error doesn't occur in .Post, but in .Edit.