Jump to content

PeterBelow

Members
  • Content Count

    460
  • Joined

  • Last visited

  • Days Won

    13

Posts posted by PeterBelow


  1. 14 minutes ago, Stano said:

    In such cases I use RadioGroup. It is easier and the user immediately sees what he can and cannot do. The principle is the same.

    Does only work if only one item can be selected from the group, but IO think in OPs case selecting both OptionOne and OptionTwo would be valid.


  2. 9 hours ago, AlanScottAgain said:

    Hi

    I have a gauge that draw I on a Skia paintbox.

    I can move the gauge with the mouse. 0-100

     

    SkPaintBox1.Hint:= IntToStr(Position);
     SkPaintBox1.ShowHint:= True;

     

    Shows the hint but not as the mouse moves.


    How can I show a hint to display the current value as the mouse moves to update the gauge?

     

    Do I need to create my own hint window?

     

    Thanks

    Alan

     

    The hint system is designed to show a hint for a certain time when the mouse enters a control's real estate. In your case the mouse stays over the paintbox, so the hint is not shown again even if its value changed. Try to call Application.CancelHint after changing the value. And if you draw the gauge anyway, why not draw the value as well instead of using a hint window?


  3. 2 hours ago, Zazhir said:

    I need to set a focus inside a Tedit, simple like this. But the problem is, the component is inside a TRibbonPage, which is only showed if a clicked on. The only event that have is the RibbonTabChange (in TRibbon).

     

    I've done like this, but all the others attempts have gonne wrong....

     

    image.png.0fbcd64e77df6e325db86f4f9e3c41a7.png

    CODIGO needs to be focused, how can I do that??

     

    You have a timing issue here, the event fires before the page has become visible and the controls on it can be focused. The usual fix for such problems is to post (PostMessage) a custom message to the form and do the focus change in the handler for this message. There is also a OnTabVisibleChanged event for TRibbon, perhaps that fits better with your goal.


  4. I would rewrite this code using the routines from System.IOUtils. Use TDirectory.GetFiles to get a list of files in a directory you can then walk over.  TPath.GetTempPath gets you the user's temp folder, TFile.Delete deletes a file. Use a try except block around this statement to catch a failure to delete a file.


  5. 12 hours ago, Zazhir said:

    I have a complete delphi application using tatuk and a lot of components. 

     

    When i use a OpenDialog to call or search to a file in the Windows Explorer, and I give a right click in the mouse button the follow popup is showed.

    I bilieve that the write is corean or japanese, but I really don't know why this language is displayed, since the Windows native language that I'am using to the aplication and to my PC is Portuguese.

     

    Any help to what is going on here and how can I fix it?

     

    image.thumb.png.a310faf32e7175836402f01945c3b4fe.png

    Scan you PC for malware, looks like something installed context menu extensions for Windows explorer...


  6. 11 hours ago, Berocoder said:

    Hi, I am using latest delphi with all patches. Delphi 11 Version 28.0.46141.0937

    When I debug my application by singlestep code with F7 or F8 sooner or later I cannot continue.
    IDE is still responsive but programcounter hang and singlestep code have no effect.

    I have seen this problem before also with previous 10.4.

    Anyone with similar experience ? What can I do as workaround except to restart my application and try again.
    It seems to be completely random...

    Are you working on a 32 or 64 bit target?


  7. 6 hours ago, JohnLM said:

    Windows 7 Home 64bit

    Delphi XE7 Professional update 1 with FireDAC and Mobile add-on

    Indy version 10.6.1.518

    Android devices: (smartphone v10, and tables v4.4.4, and  v4.4.2)

     

    I am having trouble trying to get these projects copied via Save-as and Save-project-as from the IDE, to another version'ized folder. 

     

    When I start a project, I normally create a folder that describes the application name. Then, I create a version folder (i.e., v01, v02, ... v10, and so on) so that I can see the version of that project.  This helps me to keep project apps organized, debugging, etc..

     

    ** My steps are as follows for working with and saving a project into a new version folder: **

    (this is just before I close down Delphi for the project) 

     

    1. open or create a project, E:\XE7\VCL\JasonParser\v01\JasonParser_v01.dproj

    2. do work on that project. If the project is working well, I will quickly determine if that will be the final working version. If I decide, yes, then I will create a new version folder.

     

    ** Create new version folder: ** 

     

    3. Save-as (this saves the unit) thus, save into E:\XE7\VCL\JasonParser\v02\unit1.pas

    4. Save-project-as, thus, save into E:\XE7\VCL\JasonParser\v02\JasonParser_v02.dproj

    5. then, either I shut down Delphi or start a new project via steps 1 through 5.

     

    However, being my first time creating a project-group, I am lost as to how to copy over the whole project to a new version folder so that I can work on the project. 

     

    The issue I am having is that the second project group is not carrying over.  How do I fix this?

     

    With your steps you are not creating a new project group, you just rename the project. If you saved the project group before closing the IDE (the IDE should prompt you to do this) the group should contain the renamed project the next time you open it. To have more than one version in the same project group you have to explicitely add the old version to the group.

    • Like 1

  8. 13 hours ago, alogrep said:

     

    in Tbasicdm.DatamoduleCreate, is there really an underscore in the line after begin? That would be the source of the first error. The second may be a false positive, error insight is easily confused by conditional compilation...


  9. 9 minutes ago, Lainkes said:

    I have a question.
    When I start my program, there is always one of the DBCheckboxes that is active.

    How can I disable that. So that by default no value is selected.

     

    Thanks

    Set the form's ActiveControl property to some other control that can take the focus, e.g. a button.


  10. 1 hour ago, omnibrain said:

    And if I install 11.2 now, I have still to install the patch and do the fix, because there is no updated install file?

    The installer will probably only be updated when (if) a 11.3 release comes out. Just run the installer and then check the IDE about dialog. Mine shows build  28.0.46481.1287 after the patch was installed.


  11. 3 hours ago, Lainkes said:

    Hello,

     

    I have a DBGrid with records.

    On column contains a True of False value.

    Now I want this to be changed into a green icon (True) of red icon (False).

    And when clicking on the icon, it must be changed from T to F or F to T.

    Any idea how I can achieve this?

     

    Thanks

     

    Lainkes

    Handle the OnDrawColumnCell event of the grid, in it call DefaultDrawColumnCell if the cell you are asked to draw is not one in the boolean column, draw the icon on the grid canvas if it is in your special column. The OnCellClick event fires on a mouse click on the cell. The attached dataset's current record is already set to the record shown in the row clicked on, so just change the field value if the click lands on your boolean cell.

    • Like 1

  12. 6 hours ago, Tommi Prami said:

    Yo,

    As windows does the similar thing when doing file operations in explorer, if it start to take time, then it bring s dialog up, and do not flash it if operation is fast (At least sometimes it seems this way).

    I've been pondering this kind of pattern for a long time.  Never tried to code this, but as concept it might be nice, but I have feeling that this is easy to mess up, and for sure easy to kiss some corner cases to have super weird issues, I think.

    My idea would be something like

    LLazyProgress := LAzyProgressFactory(ParentFormEtc, lpMarquee, 300);
    try
      ... Work
    finally
      LLazyProgress.Free;
    end;

    If this would be network or file operation, sometimes it might be fast and sometimes very very slow,. And you kind of can't know for sure.,

    My idea was that there would be some, like 300ms delay, if process takes more time than that, progress dialog would show, 

    It could be marquee style, or if progress is more defined and known, could pass some callback for the actual progress and show it,

    Any thoughts/ideas on this. Mainly if problem with fluctuation of time process takes, sometimes there would be fast flash of dialog for user, and they never could see what was it. Completely different discussion should there be some kind of UI element to show user that progress has finished.

     

    -Tee-

    Relocate the actual work to a secondary thread. At the start of the thread's Execute method use TThread.Queue to pass a method to the main thread that creates the progress dialog. The dialog is not shown immediately, though, it just starts a timer with the delay you want. If the timer fires before the thread has completed its work, show the dialog. The dialog can the either use a timer to check for the thread's progress at intervals to update its display, or the thread can inform the dialog through Synchronized method calls of its progress. When done it can then tell the dialog to close itself, also through a Synchronized method call.

    • Like 1

  13. 5 minutes ago, Lainkes said:

    Hello,

     

    I have a lot of TCheckBox components. Now I want to change them all to TDBCheckBox components.

    Is just changing the type in my TForm class enough? Or do I need to do more?

     

    Thanks for your feedback

     

    Lainkes

    You have to change the type both in the form pas and dfm files.


  14. 17 hours ago, alogrep said:

    Hi.

    Has anyone experienced this error trying to access Registerd Users Download

    "error an existing connection was forcibly closed by the remote host"

    Is the site down, or there is (suddenly) a problem in my PC?

    THanks

    https://my.embarcadero.com/#downloadsPage works normally for me. (Win10, Firefox as browser). I did not try to download anything, though.


  15. 8 hours ago, Ian Branch said:

    Hi Team,

    D11.2.  Apps residing on a Win 2012 Server, running on the User's PC.

    Most of the Users are using Win 7 but several are on Win 10.

    My Apps write to a log file when they open and when they close.  Auditable.

    I have been trying to find out how/why some 'sessions' stay open in the Log overnight.

    The Apps have an Idle Timeout that closes them after x minutes of no mouse or keyboard activity in the App.

    I have discovered that some Users are not closing the App at the end of the day and are simply shutting down their PCs, while the App(s) are still open.  😞

    Is there some way to detect that the PC has been set to shutdown and stall it while the App(s) close gracefully?

     

     

    Regards & TIA,

    Ian

    On normal shutdown running apps get a WM_QUERYENDSESSION message, followed eventually by WM_ENDSESSION. The VCL handles WM_QUERYENDSESSION by firing the main form's OnCloseQuery event but OnClose or OnDestroy may not fire on system shutdown. So OnCloseQuery is the best place for detecting app closing.


  16. 9 hours ago, Rrodd said:

    Hello, I have a problem with the component Gauge, looks like it draws the text twice, one white and another with the inverted color (this is the only I want to be drawn), looking bad.

    I am using a "Windows VCL Application - Delphi" under Delphi 10.4.

    I'd like to know what to do for this to work like expected, or another free gauge alternative and similar component.

    I have sent a snapshot of the problem.

     

    Thanks.

    gauge01.bmp

    TGauge is a really ancient sample component (from D1 days I think). Have you looked at TProgressbar as alternative?


  17. 8 minutes ago, Henry Olive said:

    Good Day,

     

    ST := Start Time

    ET := End Time

    What if 

    ST:='17:30' and ET :='00:00'  (The Difference should be 6,50 but i get 17,50)

     

    If i change '00:00' to '12:00' this time the Difference is 5,50 not 6:50
     

     

     

    With the 24 hour clock 00:00 is interpreted as midnight starting the current day and 24:00 as midnight ending the day.


  18. 17 minutes ago, Henry Olive said:

    Good Day,
    Delphi 10.3

     

    procedure TForm2.Button1Click(Sender: TObject);
      var
      ST,ET : TDateTime;
      Diff : Double;
    begin
      ST := StrToDateTime (Edit1.Text); // Text = 08:00
      ET := StrToDateTime (Edit2.Text); // Text = 11:30

      Diff := HoursBetween(ST,ET);
      Edit3.Text := FloatToStr(Diff);


    The result of above proc is 3

    i was expecting  3,5

     

    That's just like HoursBetween works, the return value is an integer, so the difference is rounded to the next full hour. Use MinutesBetween and divide the result by 60 if you want the difference to be in fractional hours.


  19. 15 hours ago, PenelopeSkye said:

    Peter, can you tell me how to look at the libraries?

    You need to find the database component used for the connection to the database. It may reside in a data module autocreated at program start, so start by opening the dpr file (project -> view source) and check the first Application.CreateForm statements. Open the datamodules one by one and look for a component with "connection" in its type. For FireDAC that would be a TFDConnection component, which has a LoginPrompt property, which is probably set to true in your case. You can set it to false and specify user and password in the Params property to avoid the dialog. Details depend on the database access framework your app uses.


  20. 3 minutes ago, DennisTW said:

    Clicking mainform won't bring it in front of SubForm
    The following behaviour is different from Lazarus.
    procedure TForm1.BtnShowFormClick(Sender: TObject);
    begin
      SubForm := TForm.Create(Owner);
      SubForm.Show;//this will make SubForm appear in front of the current Form1.
          //Even if I click on Main Form1, it won't bring Form1 in front of SubForm again.
          //what should I do to bring Form1 in front of SubForm again?
          //I already tried bringtofront and sendtoback
    end;

    In Delphi the main form (the one created first by an Application.CreateForm statement in the DPR file) is the API owner of all forms created later, so it is lower in the Z-order. It is also the only form having a taskbar button. Lazarus seems to behave like old Delphi versions (before Windows Vista), where the zero-size Application window was the API owner of all forms and owned the taskbar button. This made all forms siblings in the Z order and allowed any form to be covered by the main form. You can get this behaviour back in Delphi by setting

    Application.MainformOnTaskbar := false;

    in the DPR file, but that is not recommended since it does not work well with the taskbar in modern Windows versions. If you really need to you can uncouple a form from the main form in Z-order by overriding its CreateParams method.

        // in form declaration
        Procedure CreateParams( Var params: TCreateParams ); override;
    
    
    Procedure TFormX.CreateParams( Var params: TCreateParams );
    begin
      inherited CreateParams( params );
      params.wndParent := 0; //or Application.Handle
      // the following gives the form its own taskbar button
      params.ExStyle := params.ExStyle  or WS_EX_APPWINDOW;
    end;

     

×