No announcement yet.

Owner Drawn Button Clicks

  • Filter
  • Time
  • Show
Clear All
new posts

  • Owner Drawn Button Clicks


    I was just wondering about a funny little thing I saw with my
    owner drawn buttons. Owner drawn buttons dont seem to be able to
    keep up with double clicks the way normal buttons do. A normal
    button responds to each click of the mouse but an owner drawn
    button seems to behave like there is a time period that needs to
    elapse before you can click on it again. I tried to set the
    ODS_SELECTED bit to zero right after I drew my button but that
    doesn't seem to help. In general there seems to be a laggy
    response from owner drawn buttons...

    What do you all have to say about this?


  • #2
    It happens to be that I have just finished a library module in MASM32 that
    was aimed at this problem of OS designed owner draw controls being messy
    to code and too slow in their operation.

    To make it available to PowerBASIC programmers, I wrote a small DLL in MASM
    which builds at 3584 bytes in size.

    The following address is the test piece that shows how to use it and the DLL.

    It has the following characteristics, you create 2 identical size bitmaps,
    one for the UP position, the other for the DOWN which are built into the
    resources of your application.

    Use LoadBitmap() on each bitmap to get a valid handle for each bitmap.

    Call the function with the parent handle, the top X/Y coordinates, both
    bitmap handles and a control ID number. The function returns the handle
    for the control.

    The control autosizes to the bitmap size and there is no requirement to
    deallocate the bitmaps after the control is destroyed.

    The advantage of this type of control is that you have absolute freedom
    with its appearance as it does not have rectangular edges visible so it
    can be used to display non rectangular shapes, all you must do is ensure
    that the background colour matches the outside colour of the bitmap.

    If you have licence to Jeremy Collake's 2 toys, PEbundle and PEcompact,
    this DLL is small enough to bundle with the EXE file and then compress
    the complete EXE file after so no-one will know that you have used a DLL.

    The DLL is licenced as freeware for PowerBASIC programmers and it can be
    used in commercial programs without any changes. The only restriction I
    place on it is that it should not be sold as an aftermarket ad-on, it can
    be supplied with commercial software written in PowerBASIC free of charge.


    [email protected]

    hutch at movsd dot com
    The MASM Forum - SLL Modules and PB Libraries