Jump to content

vshvetsov

Members
  • Content Count

    16
  • Joined

  • Last visited

Posts posted by vshvetsov


  1. Thanks a lot for the advice. I understand that these are paid packages containing many components, and the packages are quite expensive. I only need one component for the table. I was thinking about a free version of the open source component. But at the same time, it is verified, from a supported collection. Does anyone know about such a thing?


  2. Please advise which component is better to use for viewing and editing tables. The following features are needed:
    1) The cells must contain text, numeric or logical (yes/no) data.
    2) The ability to add icons to the text of the cell.
    2) In-place editing in cells. For logical values - checkbox, for text and numbers - the ability to select a value from a pop-up list.
    3) Selection of cell ranges with shift and Ctrl, normal arrow navigation.
    4) Text color and cell fill settings.
    In general, I need a fairly ordinary spreadsheet editor in the style of MS Excel. The standard TListView (with vsReport style) and TStringGrid components do not provide the necessary functionality. I also don't want to mess with TDB*** components, I don't have a database, just an array of values in memory that I manage myself. Can you recommend any good third-party component?
    Using third-party components is a dangerous thing, what if it breaks down with the next update of Rad Studio? I would like you to recommend a proven component from a reliable, "long-lived" source. Easy to learn and easy to use.

    Thank you in advance.


  3. Hi,

    I make the color of the TLabel red under some conditions:
    MyLabel->Font->Color = clRed;
    I recently applied the "Lavender classico" style in the Project Options | Application | Appearance | Cystom styles. 
    The color of the TLabel has stopped turning red! 
    Is it true that applying custom styles does not allow changing the color of the label? 
    But I need both style and the ability to change color. What to do?
    I change the color to red to indicate an error. Maybe there is some way to change the appearance of the lable, 
    compatible with custom styles?
    
     

  4. 13 hours ago, angusj said:

    I strongly suspect that this is because you haven't pre-multiplied the image before using AlphaBlend.

    Exactly. After pre-multiplication everything was fixed, thank you very much.

    A new question has arisen. It turns out that in the structure TRGBQuad the order of colors is reversed in comparison to the VCL type TColor. With a simple reinterpretation of TColor as TRGBQuad, blue becomes red, and vice versa. TColor is widely used in a VCL-application. As I understand it, your TColorEntry type in AlphaBitmaps.pas is compatible with TRGBQuad, that is, the same problem should arise with TColor. I rearrange the bytes manually. Is there any standard conversion function?


  5.  

    On 3/1/2023 at 5:07 AM, angusj said:

    While I can't guarantee it, this is likely to help:

    http://www.angusj.com/delphi/image32/Videos/cpp.mkv

     

    Absolutely!

    Edit: The 32 in the library name simply refers to image bits per pixel WRT how images are stored in memory. (And yes the library can read and write images to file using different bpp.)

    Hi, Angus! Thank you for your answers.

    Before using libraries I tried to do smth manually. I would be grateful, if you could explain me some things. 

    I draw a rather colorful image on the form. In fact, this is a map of the city, on top of which I draw lines, polygons, etc. I want to highlight the circle on the map, giving it some shade, for example, blue.

    I created a memory bitmap, set PixelFormat = pf32bit and AlphaFormat = afDefined, filled it with clBlack and drew a circle with clBlue brush. Then I manually (using ScanLine property) set the reserved byte of black pixels to 0, and of blue pixels - to some alpha-value. Then I drew this bitmap on a form using AlphaBlend() API function.

    The result is close to expected, but there are oddities. The circle does not become completely transparent with alpha=0. The result is also highly dependent on the color of the circle. For example, if we take gray instead of blue, the circle is almost white, opaque, even with alpha=0. I fill the bitmap with black around the circle because that's the only color that becomes fully transparent at alpha=0. Why is this happening?

     

     


  6. 7 hours ago, angusj said:

    ITwo graphics libraries for Delphi I can recommend:

    Graphics32: Multiple developers contributed over the last 20yrs and is widely used.

    Image32: Recently developed by me. IMHO it's a lot simpler than Graphics32 while almost as fully featured.

    Thanks for the tips.
    1) I am programming in C++. The VCL provides C++ header files for using classes and functions. 
    How will I use the Image32 (or Graphics32) library?
    2) Can I use Image32 in a 64-bit Windows application?

  7. Thank you. I tried to do it, but I didn't succeed. I created a bitmap:

     

    bitmap = new Graphics::TBitmap(w, h);

     

    and drew a circle in it. Then I drew it in TCanvas:

     

    Canvas->Draw(x, y, bitmap, opacity);

     

    The problem is that the whole rectangle is drawn as translucent, not just the ellipse. 
    To remove the margins around the ellipse, I set: 
    
    bitmap->Transparent = true; 
    bitmap->TransparentColor = clWhite; // the color of margins, can also be determined automaticaly 
                                        // as a color of the left-most pixel
    
    Then the ellipse is drawn without margins, as needed, but it is not translucent any more: 
    Canvas->Draw() ignores the opacity value.
    I don't understand how to get a translucent ellipse without margins...
    
     

  8. Hi,

    I have this code for drawing an ellipse on a canvas:

    Canvas->Pen->Color = my_Color;

    Canvas->Brush->Color = my_Color;
    Canvas->Ellipse(my_rect);

    Ellipse is drawn over a background image. How can I draw it semitransparently?

    Sorry for posting such a question that seems to be explained in the available documentation. 
    Spent several hours reading and trying, didn't succeed. Please help.

  9. Thanks a lot for the discussion. I think that the problem really comes from calls to ProcessMessages inside OnClick. I needed to switch to using threads for a very long time, but I still can’t choose the time. Does anyone know a good text about thread programming for beginners? I need
    1) performing calculations with displaying progress in the window and the possibility of interruption,
    2) parallelization.
    Of course, there are many texts, but I will be grateful for a link to a good one.


  10. On 6/30/2022 at 12:41 PM, David Heffernan said:

    This should just work. The real question is why your modal message box is not on top. You should try to work that out.

    1) I show the form with ShowModal().

    2) I press the button "Execute".

    3) In a ButtonClick event handler I call Func().

    4) Func performs long mathematical calculation.

    5) During the calculation Func regularily calls Application->ProcessMessages().

    6) During the calculation I often swith to other applications on my comp and do smth else.

    7) At the end of calculation Func() calls Application->MessageBox().

    I don't know, what other details could be important for the description of the situation.


  11. On 6/27/2022 at 11:18 AM, Fr0sT.Brutal said:

    which turns out to call FOnGetActiveFormHandle event which you can handle manually. 

    Do you mean, I may write a ApplicationGetActiveFormHandle function, assign the function to Application->FOnGetActiveFormHandle, and set any form as an active form? Couldn't this mess up the Application object? After all, the object uses GetActiveFormHandle in other situations as well?


  12. On 6/27/2022 at 8:29 PM, Remy Lebeau said:

    You could alternatively just call the Win32 MessageBox() API directly (or TaskDialog/Indirect() instead), specifying the desired Form window as its owner window.

    The function Func() belongs to the "kernel" part of my code, it doesn't know anything about forms. In fact, all my kernel functions, when they want to give a message, generate a special MyKernel.OnMessage(string, MB_flags) event. In the "interface" part of the program, a general response to this event is implemented. It simply passes string and flags to an Application->MessageBox. When a OnMessage event is generated by kernel functions, different forms can be active (and are not guaranteed to have focus). To determine an active form I would need to write a complex code. But I just need to display a message on the screen so that it is guaranteed to be visible. It's a pity, if it is not possible. Maybe it will help to explicitly specify the MB_TOPMOST flag in a MessageBox?


  13. Hi,

    My function Func() calls Application->MessageBox(..). If Func() is called from a member function of a modal form, then sometimes (not always!) the message box appears hidden under the modal form. In this case, the modal form is not active. It looks like my app is stuck. Switching between windows in Windows with Alt-tab helps to see the message.
    What could be the reason? How can you ensure that the message box always appears on top of all open windows?

×