Gary
-
Content Count
128 -
Joined
-
Last visited
Posts posted by Gary
-
-
I use a similar approach as aehimself for Window programs with an addition I saw in a Holger Flick video.
He created a very simple static TController class and replaced the .dpr code with a single line:
begin TAppController.Run; end.
This way you don't have to add code to the .dpr which I have had cause trouble in the past since Delphi edits this file as well. You can add code to the Run procedure and not worry about messing things up.
TAppController = class public class procedure Run; private class function CheckSingleton: Boolean; class procedure SetFocusRunningInstance; end; class function TAppController.CheckSingleton: Boolean; begin Result := FindWindow(WINDOW_CLASS_NAME, nil) = 0; end; class procedure TAppController.SetFocusRunningInstance; begin ShowWindow(FindWindow(WINDOW_CLASS_NAME, nil), SW_SHOWMAXIMIZED); end; class procedure TAppController.Run; begin Application.Initialize; Application.MainFormOnTaskbar := True; if TAppController.CheckSingleton then begin //Add conditional defines, splash screen whatever Application.Run; end else begin TAppController.SetFocusRunningInstance; end; end;
Someone else (Can't remember where) also suggested setting the main form window to something unique you need to override the CreateParams of the Main form.
procedure TfrmMain.CreateParams(var Params: TCreateParams); begin inherited; StrCopy(Params.WinClassName, WINDOW_CLASS_NAME); end;
- 2
-
Follow the tutorial. Setting "Movement" in the event is just the first step, the actual moving of the image is done later with a timer.
-
If you are following the tutorial you should start a new project. Select New / Multi-Device Application not Windows VCL Application. In this case the Windows VCL TListBox component does not have the " var KeyChar : char" parameter that the Multi-Device TListBox component has. Many others could be different as well and that would create serious cause of confusion.
- 1
-
Here you go Will.
The tutorial is a multi platform application, you started a VCL application, the controls have different parameters.
- 1
-
Interesting, I looked at the video Will is following take a look at 2:54. The tutorial's ListBox OnKeyDown event has an additional parameter var KeyChar : char that the instructor is using therefore the 'w' instead of Ord('w').
My ListBox doesn't have that parameter and neither does Will's. Anybody know what's going on? 2:06 shows Delphi 10.2
-
Hello all,
Anyone else have this problem? I get a quote from Embarcadero for my renewal with a link. Go to link fill in all information and press submit or whatever. I get a failed message, and the link no longer works because it actually went through, at least the charge did. Embarcadero has no record of payment but My card company cleared the transaction March 1st 7 days ago. I had the same problem last year and complained to Embarcadero. Just wondering if it's just my issue or has anyone else had issues with online subscription renewal?
-
11.3 on my laptop 13" Project menu doesn't fit on screen and cannot scroll so Project/Options (Last Item) and Eurekalog options are inaccessible. Anyone else have this problem?
-
Once again Embarcadero's licensing policy causes pain!! 11.3 is out so I cleaned up the 2 computers I have Delphi installed, one with a complete reinstall of Windows, however something I have been wanting to do for some time is rename both from the stock unintelligible names. I did contact support about this in advance and since I'm on contract, they told me no problem. Took today off for this big install -- Registration limit exceeded!! I did email support for a bump but have a totally wasted day, and who knows how long it will take? BTW just paid ransom yesterday, expires on the 12th.
-
I use WebView4Delphi as well. Recently I needed to manipulate a web site to navigate to, select a report, run it then download the report as a csv file. WebView4Delphi had all the needed control. I have never done web development, so it took several days and multiple Stack Overflow posts to get it to work but it has been running flawlessly for weeks now, downloading every half hour.
- 1
-
@salvadordf
I figured it was a matter of drilling down to the element.
3 hours later after much trial and error, Success!!
Quoteprocedure TfrmLocation.actRefreshReportExecute(Sender: TObject);
begin
WVBrowser.ExecuteScript('iframes = document.getElementsByTagName("iframe");'+
'iframes[1].contentWindow.document.getElementById("linkRefresh").click();');
end;So frustrating spending so much time for what you already know is going to be 1 or 2 lines of code because of your ignorance but satisfying when done.
Thank you so much.
- 1
-
Delphi 11.2 WebView4Delphi
Hello all,
I posted on StackOverflow yesterday, but no solution, probably because this seems to be such an easy fix.
I am totally new to Web/JavaScript programming and just need to refresh and download a csv file from a geo location service every half hour.
I have everything working except what should be the easiest part, simply clicking the refresh button on the page.
I am using an ActionList and menu to test each step for now. What I have so far:
A running app that can navigate to the site, open the report, and download the file to a Nas drive overwriting the previous file. The download logs when finished.
Before downloading I need to refresh the report. If I inspect the element in the browser it takes me to this list item:
<a id="linkRefresh" href="#" class="tools refresh report-action" data-action="refreshReport" data-event="click"> <span class="report-edit-icon refresh"></span> <span class="tool-label">Refresh</span></a>
In my test action I have this code:
procedure TfrmLocation.actRefreshReportExecute(Sender: TObject); begin WVBrowser.ExecuteScript('document.getElementById("linkRefresh").click()'); end;
Nothing happens, is there something I'm missing? Is there an easier way to do this? Is there a way to verify that a valid element is being returned? Can there be more than one document in the page, this button is inside a frame with a #document element?
I have spent 2 days on this so far, any help would be appreciated.
-
Hello all,
I have an app that dynamically changes the style. On close it saves style to ini and reloads on startup.
Changing style and closing is fine with any style except if the app has changed style to windows. App crashes after writing to ini, so if app starts with windows style and closes without changing all is fine. I logged the OnClose of the Main form and get no errors.
Debug shows the problem in the TStyleEngine.DoUnregisterStyleHook call and jumps to System here:
function _IsClass(const Child: TObject; Parent: TClass): Boolean; begin Result := (Child <> nil) and Child.InheritsFrom(Parent); end;
I have included the EurekaLog file.
Any help?
Gary
-
@jonnyg You're correct, I should have been clearer. I just run the latest version of Delphi but have some components that the update has expired as well as open-source components I no longer use. I did buy a Windows 11 license and install Delphi and the needed components to support my old app. All seems to work well. The only problem I have had is the VM will lock up at times requiring a reset.
-
There is an interview with the author on Embarcadero's YouTube channel you may be interested in
Upgrading and Maintaining Delphi Legacy Projects
-
Hello all,
I am going to do a clean install of Delphi but don't want to install all the old components that I no longer use. I still need them to support legacy apps, so want to try loading up a VM with those components.
What are you using for VM, and what settings work best?
My current Machine:
11th Gen Intel(R) Core(TM) i7
32 GB Ram
1 TB SSD
Windows 11
Delphi 11.2
I would also like to run it on an older laptop
10th Gen i7
16 GB Ram
1 TB SSD
Or is there a better way to support old apps that use components who's license has expired?
-
@Programmer..
I think I will take this opportunity to do a clean install. This is a secondary machine(Laptop) that has a lot of old components I keep on it to support Legacy apps. I have been wanting to move them to a VM, so this will give me a chance to experiment with that.
I'll open a new topic for VM suggestions, the latest discussion I could find was from 2019
Thanks for the help[
-
@Programmer...
It happened after Delphi offered to correct my path to allow run time packages. Foolishly clicked OK
-
@limelect
All my styles are in C:\Users\Public\Documents\Embarcadero\Studio\22.0\Styles
-
BDSCOMMONDIR c:\program files (x86)\embarcadero\studio\22.0\bin\22.0
That seems to be the problem, the last \22.0
How do I change it?
-
It's not just the project, the styles are not in the IDE. Project/Options/Appearance all styles are empty including default Windows style. Delphi IDE Style directory is wrong. I don't know where to redirect to the correct location
-
Hello all,
My styles have disappeared from the IDE, and now projects will not compile. I get an intermediate .vrc file with the error cannot find file on this line:
IcebergClassico VCLSTYLE "c:\\program files (x86)\\embarcadero\\studio\\22.0\\bin\\22.0\\Styles\\IcebergClassico.vsf"
The files are where they are supposed to be in : C:\Users\Public\Documents\Embarcadero\Studio\22.0\Styles not the above.
This happened after Delphi asked to update my path for run time packages (I'm not currently using run time packages). How do I point the IDE to the correct location.
Thanks
-
Thanks Anders
-
Agreed, however this is a small company with 4 users in 2 offices next to each other over a LAN connection. Leaving for lunch has happened 🙂. When they return their co-worker looks across the desk and says "Quit doing that". Handled!
Seriously though I also read posts about "Ghost" locks, not sure what they are, but sounds as if a problem occurs while the record is locked it could leave the lock in place indefinably.
Recently they did a price increase, several times they ended up editing the same record in Quickbooks (much bigger program than mine). When they would try to post the record they would immediately get a message telling them to try again. They have asked me to do the same. Simply checking if the record is being edited by someone else, either before editing or posting seems like an easy fix, until you try to implement it.
-
More correctly the DataSet could have other record locks, but the BeforeEdit would know the record in question. If not then instead of is DataSet.locked it would be if CurrRecord.Locked or the substance of.
Help to find database error
in Databases
Posted
It's easy to get confused at first. What ioan is saying the procedure "ShowSelectResults" or "ShowSelectedResults" you decide has to match. However, in the implementation section at the top inside your class TfrmDatabaseTutorial in the public section you do not use the class name just
public { Public declarations } procedure ShowSelectedResults;
Down below in the implementation section where you write your code you need the class name then a period then the procedure with exact spelling
procedure TDatabaseTutorial.ShowSelectedResults(); begin //code end;
If you get rid of the class name from the implementation section and just leave "procedure ShowSelectedResults;" then with your cursor on the line press ctrl + shift + c Delphi will create the implementation section for you and you don't have to worry about spelling.