Jump to content

Tom F

Members
  • Content Count

    211
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Tom F


  1. We have used https://www.mitov.com/products/videolab#overview for 13 years.  Excellent library to which I owe my company's product's success on Windows and macOS.  His tools are threaded, which means you get maximum through-put and the VCL doesn't freeze.

    Free trial and free to non-commercial organizations. 

    The installer puts some demo programs here C:\Program Files (x86)\Embarcadero\Studio\22.0\LabPacks\Demos.  You'll find one there that lets you process frame by frame either a live feed or file playback.  Just drop a few components on a designer, hook them up, and grab the "Frame Ready" event to process your data.

    Check out some of his other tools. He has some real-time tools that do pattern recognition and may be all you need.

    Boian Mitov is brilliant, IMO.  His tools are the best we could find. No royalties necessary.  No confusion about FFMPEG patent licensing, which we always worried about.

     

    The attached sample has a video feed (of a telescope spectrometer) on the left and some data extracted on the Mitov plot on the right.

    Tom 

     

     

    mitov.gif

    • Like 1

  2. I'm not sure if this is what you're looking for, but see https://www.swissdelphicenter.ch/en/showcode.php?id=946, where we found the code below.

     

    We've been using this code from there for more than ten years with no problems:

     

    procedure HookResourceString(rs: PResStringRec; newStr: PChar);
    var
      oldprotect: DWORD;
    begin
      VirtualProtect(rs, SizeOf(rs^), PAGE_EXECUTE_READWRITE, @oldProtect);
      rs^.Identifier := Integer(newStr);
      VirtualProtect(rs, SizeOf(rs^), oldProtect, @oldProtect);
    end;
    
    const
      NewOK: PChar = 'New Ok';
      NewCancel: PChar = 'New Cancel';
    
    initialization
      HookResourceString(@SMsgDlgOK, NewOK);
      HookResourceString(@SMsgDlgCancel, NewCancel);

     


  3. When using a style (e.g.Windows10), the dialog that is displayed by the code below is not resizable. (i.e. There is no handle in the lower right corner with which to drag the window larger.)

    When using the default Windows style or removing the Options line from the code, there is no problem.

    We had hoped to start using styles in our app, but a bug like this is discouraging. 

     

    var
      SaveDialog1: TSaveDialog;
    begin
      SaveDialog1 := TSaveDialog.Create(Self);
      SaveDialog1.Options := [ofOverwritePrompt]; // removing this line eliminates the problem
      SaveDialog1.Execute;
      SaveDialog1.Free;
    end;

    Windows 10, D11.1, 32-bit app. Reported here https://quality.embarcadero.com/browse/RSP-38868

     

    Edit:  I decided to add a screen capture showing the missing grab handle to resize.  I've noticed that when using a style, the dialog box that is missing the grab handle is a different type. It has icons on the left rather than a directory tree.  It appears that the VCL Styles changes the dialog box type.  What's the difference?  Is there a way to show the "old style" (with a tree) when using styles??

    image.thumb.png.ffcc2b8a8e170cd0958e0960ea5d2f3d.png


  4. 4 hours ago, mvanrijnen said:

     

    I like to read this kind of things instead of watching YT 😉

    (just a comment)

    I prefer to read rather than watching YT too.   However, these days I find many solutions are on YT rather than in prose.  I often play YT videos at 1.5 or 1.75  speedup so I don't waste as much time.

     

     


  5. Thanks for your helpful feedback @Dalija Prasnikar @Uwe Raabe @Darian Miller.and others.

     

    I created a tiny test program that has the same flashing problem on the main form and subform.

     

    I tested it on another machine, and on a VM on my machine and there's no flashing!  WTF?!

     

    I updated all my monitor drivers and the problem remains on my computer. 

     

    It's hard to know how frequent or rare this problem will be in the field.   ¯\_()_/¯

     

    I'm going to post the source in a new thread and ask for members to download, compile, and test.

     

    Thanks again for taking the time to respond to my OP and for all your contributions to our community.

    Tom


  6. Thanks, @Darian Miller.

     

    In my opinion, Delpih Styles is worse than worthless as long as the flicker is there. 

     

    If my software exhibited this kind of flicker, it would be laughed at by our customers. There's no way I use Styles as long as this defect continues to exist.

     

    I'm disappointed that EMB would pretend that this feature works.

     


  7. I'm always wary of "just trying it" because I worry that my testing might fail to uncover some problem context that I wasn't aware of.

     

    But, I answered my OP question #1 here by, um,  just trying it. The line below causes the VCL to refresh all Toobar buttons with the contents of the ImageList.

    ToolBar.Images := ImageList;

    So, if my user switches from a Light to a Dark style, I can use the above code to switch to a different set of toolbar icons.

    I asked my OP question #2  very poorly. I know very little about image files, alpha channels, etc.

    Here's the question rephrased:

    I am going to hire a graphics designer to design 32x32 icons for a toolbar similar the DIY-designed 16x16 ones below.

     

    image.png.abe9e6239dc5a38643c56faae33c1864.png

     

    Since we are going to allow the user to select a light or dark VCL style, is my thinking correct that we probably need a second set of similar icons, but designed for dark styles, especially if our icons us a lot of transparency for their background. Otherwise, on a dark style, using icons that work on a light style like the above looks terrible, like this:

     

    image.png.8fa84e71e8b07265a11174102a800d81.png

     

    I will be adding the files that the graphic designer delivers to two ImageLists used by a Toolbar and its ToolButtons.  We are not going to support different DPIs at the current time.

     

    I plan to ask the designer for the same icon twice, one icon that looks good on a light background and one that looks good on a dark background.

     

    What else do I need to ask the designer given the above scenario?  What file type, what about transparency?  When adding these files to the ImageList, how do the Transparent Color and Fill Color fields (below) come into play?  How do I avoid the kind of red shadow shown below from occurring? (The source file for the image below is in the OP as circle2.bmp.)

     

    image.png.3815c6bf2b6f312d904191146aeaa83f.png

    I want to be able to give my designer clear instructions on the format of their deliverable. Something like: "We want you to deliver color, 32x32 png files with an alpha channel for transparency"

     

    Are png files the file of choice for a project like this or does another file type work better?

    Is there anything else I need to tell the designer?

    Am I over-thinking this?

     




     


  8. I'm going to have a light style and dark style in our D11, VCL, app.  

    Question 1: What's the recommended way to handle TToolButton 32x32 images being different in an app where the user can switch between a light and dark style?   

     

    What would be a good way to change a TToolButton's image from an image that is designed for a light style and an image that is designed for a dark style?

     

    Perhaps if I have two TImageLists, can I just do this Toolbar1.Images := ImageList1 or  Toolbar1.Images := ImageList2; ???

    Or perhaps I can change the ToolButton image as in ToolButton1.ImageIndex := 8 or ToolButton1.ImageIndex := 2; ???

     

    Is some sort of refresh necessary to force an assignment like the above to be applied?  (I can have the user shut down the program if it's necessary for the assignment to occur before the toolbar is created, doing it in in TForm.Create before the TForm's TFrame is created?)

     

    Question 2:  Transparency! Should I use it? I'm wondering whether I ought to just have our graphics designer create two sets of buttons not using transparency, hardwiring the button image's background to either a light or dark color rather than relying on transparency.

    And I wonder that because I'm having trouble understanding how alpha colors work. 

    https://docwiki.embarcadero.com/RADStudio/Sydney/en/Image_List_Editor says: 

    Quote

    If you add an image (using the Add button) to the image list, you can - during the current invocation of the ImageList editor - alter properties of the selected image using the Transparent Color, Fill Color, and Options controls. However, once the ImageList editor is closed, these properties are fixed. If you select this image during new invocations of the ImageList editor, the Transparent Color, Fill Color, and Options controls are grayed and you cannot change any properties of the image.

     

    So I created a TBitMap with a green circle and reddish background that I want to be transparent. This is it (and attached as circle2.bmp.)

     

    image.png.c4254888791815e831d307ce472ec583.png

     

    But when I add the image in the ImageList editor, the circle has a red tinge remains around it in the editor and button.


    image.thumb.png.e321d09327dd867a448d2ab2d89983d5.png
     

     

     

    Have you faced either of the two issues above?

     

     

    circle2.bmp


  9. 7 hours ago, Sherlock said:

    Any style that differs from the current OSes UI style and style guide, will cause an application to look and feel strangely out of place. You might want or like that, but most of the time users will feel uneasy about it as soon as the initial "wow how pretty" effect has faded to "why is the quit button green?". So in essence styles to me are just another toy where Embarcadero has wasted precious time and money, both of which are direly needed in other areas of the product.

    Hi, Sherlock,

    I disagree with you.  I don't think styles are a toy or a waste of EMB time and money.  

    Styles are a necessary tool to allow us developers to modify our apps. I agree that massive changes are ill-advised and will confuse the user. But many modern apps (including the IDE) have a dark mode, which is what we are using styles for. We're not going to make massive changes to the UI that would confuse the user.

    • Like 6

  10. 10 minutes ago, Uwe Raabe said:

    Any answer would probably depend on someone's personal opinion.

    Uwe,  yes, undoubtedly there is some subjectivity to this.  UI design is going to be personal to some degree.

    However, IMO, that doesn't negate the value of hearing about other people's experiences.

     

     


  11. Every once in a while, I've tried each of Delphi's custom styles in my D11 Windows app.

     

    Every time I try them, the result looks a bit "off" to me. Often, it isn't quite good enough to look professional.

     

    I'm not a graphics designer; I don't know anything about choosing a color palette. 

     

    I believe that EMB has improved its custom styles (and its implementation in the VCL) over the years.  Perhaps I was soured by the initial versions if they were really bad.

     

    But, sit still seems with my app that there are glitches where the coloring isn't quite right. Perhaps one component wasn't ever polished by EMB. Or maybe one of my TPanels on which there's another TPanel doesn't get properly colored, etc.

     

    I know some of this might be because of the non-standard, third party visual components that I'm using: Raize, and Mitov, although both vendors produce wonderful tools, so I doubt this is their problem.  Perhaps my placement of visual components is broken. Perhaps the Parent property on some visual objects is wrong after 13 years of adding and removing components to forms.

     

    I  know I can modify custom styles if the problem is cosmetic. I'm trying to avoid that (or at least reduce) the learning curve and piece-work of patching up problems.

     

    What's the consensus on custom styles?  Do they work?  Are you using them? How much trouble did you have? Are there any specific dark styles from EMB or others that you think work best?  Did you have to modify them or your forms, or did they work out of the box?  Are there some styles that are so ugly or buggy that they're unusable?

     

    Are there any "best practices" around styles?

     

    What about styles from third parties like DelphiStyles? Have you used them?  I have no problem paying for a custom style if it eliminates work. Are custom styles from third parties higher quality aesthetically? More thoroughly implemented? More likely to work without modification? Are there any other 3rd party vendors of custom styles that you've used?

    • Like 1

  12. 1 hour ago, Remy Lebeau said:

    You can't perform arithmetic with a Double and a String as operands.  You have to first convert the String to a Double/Extended first. Use StrToFloat() or equivalent for that.  And then you can convert the result back to a String using FloatToStr() or equivalent.

     

    Try something more like this:

    
    DBEdit43.Text := FloatToStr(0.000844 * StrToFloat(scGPDBEdit82.Text));

     

    Also note, aehimself, that StrToFloat will cause an exception if scGPDBEDit82.Text is not a valid floating point number.

    To avoid that, you could use https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.SysUtils.StrToFloatDef If the conversion fails, the default is returned instead. 

     

     

    • Thanks 1

  13. Not specifically a Delphi question:

    I wrote a program that reads a registry entry of someone else's program, "ProgramX".

     

    When I install ProgramX on my Win10 machine, I find ProgamX's registry entries where I expect them:

     

    Computer\HKEY_CURRENT_USER\SOFTWARE\CompanyName\ProgramX.

    However, when a user of my program installed ProgramX on their computer, my program doesn't find that registry entry.

     

    The user tells me he used RegEdit to find  the entries here:

     

    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\StorageDevicePolicies\SOFTWARE\CompanyName\ProgramX.

     

    The user is 12 time zones away from me and speaks a different language, so it is difficult to communicate with him.

     

    I have googled "CurrentControlSet" but am unable to find anything that explains why CurrentControlSet exists. Is it created explicitly by an application, or is it created automatically by Windows, and why? Is it only created on certain machines, perhaps when there is more than one Windows login?

     

    Is reasonable for my program to check the HKEY_CURRENT_USER path for the key and if not found, try to find the registry entries in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet path?


  14. I can't get Code Completion to work.  It pops up suggestions when I type a period after an object name. 

    But, when I type a standalone variable name, I want it to offer a list of matching variables. 

    For example, in an empty project, when I type "Vari" below, I want it to automatically suggest VariableName.  Or must I always hit CTRL-Space for that list?

     

    procedure TForm1.FormShow(Sender: TObject);
    var VariableName: integer;
    begin
       Vari
    end;

     

    Is there some configuration option I've missed enabling?

     

    This is in D11 with Update 1. My configuration: 

     

    image.thumb.png.831d61ef10e4a2e3d8898ae69f9b1ed7.png

×