-
Content Count
1406 -
Joined
-
Last visited
-
Days Won
22
Everything posted by programmerdelphi2k
-
Attempt to release mutex not owned by caller
programmerdelphi2k replied to desert_coffee's topic in RTL and Delphi Object Pascal
if your new class inherited from "TInterfacedObject" defined as: => class(TObject, IInterface), then, would necessary or: add a new custom-interface (your) on class definition: TLockGuard = class(TInterfacedObject, IYourInterfaceCustom) or use a default, like IInterface, maybe "IUnKnown" then, you can just nil'ED to call the "destruction" -
TClientDataset gives access violation when open
programmerdelphi2k replied to ChrisChuah's topic in Databases
my tip: verify all points where your "query/clientdataset" is used! try verify if exists any try to access/changes state (open/close/edit/etc...)! it's not easy think if none code is showed -
Attempt to release mutex not owned by caller
programmerdelphi2k replied to desert_coffee's topic in RTL and Delphi Object Pascal
constructor Create(mtx: TMutex; name: String = ''); the "obj" Mutex is not been created on this class, but only "Acquired", then needs "free or release" on the "origin" not in this class! I believe that would be this: type TLockGuard = class(TInterfacedObject) private FMutex: TMutex; public constructor Create; destructor Destroy; override; // procedure MyTaskNeedsAMutex; end; { TLockGuard } constructor TLockGuard.Create; begin FMutex := TMutex.Create(); end; destructor TLockGuard.Destroy; begin FMutex.Free; inherited; end; procedure TLockGuard.MyTaskNeedsAMutex; begin FMutex.Acquire; try // do the task finally FMutex.Release; end; end; -
How to open a file in the already running IDE?
programmerdelphi2k replied to aehimself's topic in Delphi IDE and APIs
my bet would be "verify if a [process] is running and call it with your params", else, run the process! that way, you avoid any Conflict of interests! -
Look, "StartWindowsResize" is called JUST 1x in all framework FMX, and this called is done in "procedure TCommonCustomForm.MouseDown"!!! try "Find in files" by "StartWindowResize" in your RAD sources and see for youself! other hand, "resize" procedure is called by "any try of resize your forms", be using mouse or by code! until when creating a form your "resize event/procedure" can be called!!! another thing, forget the direct relationship between VCL and FMX!!! two frameworks works distinctly in almost all, sometimes until in RTL functions! my tip: use a "flag" to prevent any situation like "start/stop" a task for example! Form.RESIZE: Occurs immediately after the form is resized LFlagExecuteVideo = true; Form.Paint: Occurs when the form is redrawn. = LFlagExecuteVideo = false;
-
problem on update sdk ndk in delphi 11
programmerdelphi2k replied to saeedbay's topic in Cross-platform
read my comment -
For sure, I dont know! Because each case is a case! It would be +/- : uses System.Generics.Collections; type TMyObjList = TList<string>; // example using "strings", but can be any others types, including other objects // TMyObjList = TList<MyType>; var MyObjList: TMyObjList; ... // to start jobs, you would create a list MyObjList := TMyObjList.Create; // .... // // accessing items you would have protect it before any read/write to avoid conflicts // using TMonitor, TCriticalSection, etc... // xxxx.Lock( MyObjList ); // MyObjList.Add('message...'); MyObjList.Items[ 0 ]; MyObjList.Remove('message...'); MyObjList[ 0 ] := 'message...'; // after read/write you release the object xxxx.UnLock( MyObjList ); //.... // // at end "all" (for example, end app) you can destroy the list MyObjList.Free; better would be have yourself "class" to easy acess to your list
-
look at "procedure TCommonCustomForm.MouseDown(Button: TMouseButton; Shift: TShiftState; AFormX, AFormY: Single);", FMX.Forms.pas, line 3861 (RAD 11.2) this procedure is called by "OnMouseDown"... not automatically! I think that it dont be used for this propose (if resize... stop my task)
-
RAD HELP to StartWindowResize: Signals that this form's window is about to be resized. StartWindowResize exits if this form has a csDesigning component state
-
maybe, "Observer Pattern" (or similar) can replace your "PostMessage", and allow add more params with help you, for example using "pair" values! Form1 subscribe a list (global but protected on access), and the threads notify this list! The "list", can be a object TList or similar, to register all "subscribers" (for example, Form1). Then, the threads look this list and send the notifications for any one interested on the message! basically, the same behaviour than "PostMessage" do it! not necessary!!!
-
First, the use of global variables/objects does not guarantee that their value is the same as the one sent by the sender, as many senders may change the expected value, especially in an asynchronous (or not) sending/receiving. Here, you will certainly have a conflict of interest between the various calls involved. To try to guarantee receipt (expected), you would have to use some kind of lock to the variable/object with the expected value. Creating a kind of "access queue" to it! However, this still does not guarantee receipt in the order sent, especially if the sending is asynchronous. Perhaps, if you use a way to "enumerate" the sent messages, for example, in a pair: ("index", "message"). Then, on the other side, you could sort in order of arrival, and thus have your queue sorted! But if order of arrival doesn't matter, forget about this part! See about the use of means of blocking simultaneous access to information, such as: TCriticalSection, TMonitor, Semaphores, etc... When using "ShowMessage()" everything seems to work, precisely because it "stops" the process until the user clicks "OK" to continue! It's just a false positive! or a positive-false!
-
MSWindows 10 21H2/ RAD Studio 11.2 Alexandria
-
How do I handle the 'closed dataset' error ?
programmerdelphi2k replied to JohnLM's topic in Databases
if you "SQLite" is using "auto-increment" in ID field, then you can just ignore this field when inserting a new record for example! -- Insert into TableX(fieldA, FieldB,etc...) values(valueA, ValueB,etc..); // qry.EXECUTE; -- Select * from TableX;// qry.OPEN https://www.sqlitetutorial.net/sqlite-insert/ -
How do I handle the 'closed dataset' error ?
programmerdelphi2k replied to JohnLM's topic in Databases
First, any derived StringGrid ("Grids/StringGrid/etc...") in Firemonkey is not data aware like the DBGrid in VCL is! So, forget about this relationship here at Firemonkey! FMX uses the LiveBinding framework to make the bridge between the StringGrid/Grid and the data source (table/query/etc...), and the component/class used is the "BindSourceDB" (same function as the Datasource in VCL) ; you don't need to keep opening and closing the database connection! Unless you need it for some reasonable reason, eg low bandwidth connection etc... you can: before or when o form is open: FDConn.Open; after or when o form is closed: FDConn.Close; // this close all datasets using this connection component! you close the "query" only when: dont needs anymore use it needs changes the SQL text needs changes some params (if dont using PARAMetrization correctly) when using: "Select" you should use "qry.OPEN" // return a data-set when using: "Insert, Delete, Update" you should use "qry.EXECUTE" // execute dont return any data-set! said this, then you can try: procedure TForm1.Button1Click(Sender: TObject); begin FDQuery.Close; // to execute a new statement, or end session! for example // // you can use this way to new statment, be OPEN or EXECUTE! //FDQuery.SQL.Text := '.... new statement ....'; // FDQuery.ExecSQL('your Insert,Delete, Update expression'); // to execute your command // // to open your query with data refreshed FDQuery.Open('your Select... expression'); // to show your data-set result // FDQuery.Close; // to close your query."OPENED" end; I think that your "error" should be because your "statement" is wrong!!!! try see what is the SQL text after "qry.SQL.Assign(m1.Lines);" ShowMessage( qry.SQL.Text ); -
How do I handle the 'closed dataset' error ?
programmerdelphi2k replied to JohnLM's topic in Databases
have you seen if your "index" is corrupet or similar? then the table cannot be opened! if yes, try recreate it using your "SQLite" manager tool -
How to open a file in the already running IDE?
programmerdelphi2k replied to aehimself's topic in Delphi IDE and APIs
if I see "more public posts", no matter whose it is, I post here! -
How do I delete a row in a database with FireDAC?
programmerdelphi2k replied to JohnLM's topic in Databases
or just: FDQuery1.ExecSQL('....', [],[]); qry.SQL.EXECSQL( LSQLText + '; select * from tablex'); -
How to open a file in the already running IDE?
programmerdelphi2k replied to aehimself's topic in Delphi IDE and APIs
nothing yet? -
How to open a file in the already running IDE?
programmerdelphi2k replied to aehimself's topic in Delphi IDE and APIs
si vous avez un problème avec votre virilité ce n'est pas mon problème ! Résoudre! Je suis aussi un homme et je n'aime que les femmes ! Le mot "mon cher" n'est qu'une ironie, pas une déclaration de genre ! Enfin, si Google renvoie le mauvais contexte, je ne suis pas responsable ! Même parce que je ne parle pas français du tout ! Mon chéri! C'est fini pour moi ! Je ne répondrai plus aux railleries ! C'est la fin! --- if you have a problem with your manhood it's not my problem! Resolve! I'm also a man, and I only like women! The word "my dear" is just an irony, not a gender statement! Finally, if Google is returning the wrong context, I'm not responsible! Even because I don't speak French at all! Mon cherie! It's over for me! I will no longer respond to taunts! It's the end! -
How to handle/close FreeReport's Preview? (D7)
programmerdelphi2k replied to PizzaProgram's topic in VCL
to access fields/property protected you can try: type TMyHack = class( TClass_to_Hack ) ;;// ex.: TfrxPreview ... to usage TMyHack( instance of object ).xxxxProperty/Field Ex.: TMyHack( MyPreview ) -
How to handle/close FreeReport's Preview? (D7)
programmerdelphi2k replied to PizzaProgram's topic in VCL
by FastReport DEMO: TForm1 = class(TForm) frxPreview: TfrxPreview; frxReport: TfrxReport; HScroll: TScrollBar; VScroll: TScrollBar; Button1: TButton; Button2: TButton; procedure HScrollScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); procedure VScrollScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); procedure frxPreviewOnScrollPosChange(Sender: TObject; Orientation: TfrxScrollerOrientation; var Value: Integer); procedure frxPreviewOnScrollMaxChange(Sender: TObject; Orientation: TfrxScrollerOrientation; Value: Integer); ... procedure TForm1.HScrollScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); begin frxPreview.Workspace.HorzPosition := ScrollPos; end; procedure TForm1.VScrollScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); begin frxPreview.Workspace.VertPosition := ScrollPos; end; procedure TForm1.frxPreviewOnScrollMaxChange(Sender: TObject; Orientation: TfrxScrollerOrientation; Value: Integer); begin if (Orientation = frsVertical) then begin if (VScroll <> nil) then // not needed under Lazarus VScroll.Max := Value; end else if (HScroll <> nil) then // not needed under Lazarus HScroll.Max := Value; end; procedure TForm1.frxPreviewOnScrollPosChange(Sender: TObject; Orientation: TfrxScrollerOrientation; var Value: Integer); begin if (Orientation = frsVertical) then begin if (VScroll <> nil) then // not needed under Lazarus VScroll.Position := Value; end else if (HScroll <> nil) then // not needed under Lazarus HScroll.Position := Value; end; // assigning and preparing to show report on Preview... MyFastPreview.ActiveFrameColor := clBlue; MyFastPreview.FrameColor := clGreen; MyFastPreview.BackColor := clFuchsia; MyFastPreview.OutlineColor := clRed; MyFastPreview.OutlineVisible := true; MyFastPreview.HideScrolls := false; -
How to open a file in the already running IDE?
programmerdelphi2k replied to aehimself's topic in Delphi IDE and APIs
Je suis désolé, mais mon "français" n'est pas très bon et Google n'était pas disponible à ce moment by Google, it would be: c'est la vie mon cherie -
hy @pyscripter here Ctrl+F works, but ONLY if you focus is "right side" on help screen... not in "left side = tree menu" ... function MyOnHelp(Command: Word; Data: THelpEventData; var CallHelp: Boolean): Boolean; ... procedure TForm1.FormCreate(Sender: TObject); begin LFileCHM := ExtractFilePath(Application.ExeName) + 'data.chm'; Application.HelpFile := LFileCHM; Application.OnHelp := MyOnHelp; end; function TForm1.MyOnHelp(Command: Word; Data: THelpEventData; var CallHelp: Boolean): Boolean; begin result := true; // HH.exe is the browser used by RAD, including you can config it! on prompt type: hh /? -> show the Explorer files! ShellExecute(0, 'open', 'hh.exe', PWideChar(LFileCHM), nil, SW_SHOW); CallHelp := False; end;
-
problem on update sdk ndk in delphi 11
programmerdelphi2k replied to saeedbay's topic in Cross-platform
the SDK-values is see by Googe Play to filter apps for each Andoid version (smartphone O.S.), then, it can be installed. Or be: GooglePlay installed the app on Smartphone accord with values informed in Android Manifest! But really, you can understand that the "minimun" required for your Android O.S. is "xxxxx", and the SDK "target" is used by Google!... "max" does not exists in fact! Then if your Android O.S. needs "XX" as "minimum", then, dont worry about target (since you dont use functions restrict to "XX" version)! you can "manually" change the AndroidManifest.template.xml" if want, but this dont do it "like an app totally supported by your Android O.S. / smartphone" <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="33"/> <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="32" /> this will be the default after build your project on RAD 11/Android64 "33" is not supported by RAD implementation, at end! https://docwiki.embarcadero.com/PlatformStatus/en/Main_Page#cite_note-3 but if your smartphone Android "doesn't complain" ... use it ant see like all worlks! -
How to handle/close FreeReport's Preview? (D7)
programmerdelphi2k replied to PizzaProgram's topic in VCL
ok