PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4]

Author Topic: CXpButton  (Read 2157 times)

Josť Roca

  • Moderator
  • Master Member
  • *****
  • Posts: 3109
    • Jos
Re: CXpButton
« Reply #45 on: July 09, 2018, 11:48:29 PM »

I have added:

Code: [Select]
      CASE BM_CLICK
         .SendMessageW hwnd, WM_LBUTTONDOWN, 0, 0
         .SendMessageW hwnd, WM_LBUTTONUP, 0, 0
         EXIT FUNCTION

Not tested yet, but it should work.
« Last Edit: July 10, 2018, 02:28:26 PM by Josť Roca »
Logged

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8635
  • Windows 10
    • PlanetSquires Software
Re: CXpButton
« Reply #46 on: July 10, 2018, 01:41:22 PM »

I doubt that will work because LBUTTONDOWN and LBUTTONUP do hit testing based on the cursor position to determine if the user has clicked the button. When I get home this evening I will work up some code and post it here for you to include in the button class.

Thanks, Paul
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • Moderator
  • Master Member
  • *****
  • Posts: 3109
    • Jos
Re: CXpButton
« Reply #47 on: July 10, 2018, 02:29:51 PM »

You're right. I had no time for testing it. Let's see if this works:

Code: [Select]
      CASE BM_CLICK
         IF .IsWindowEnabled(hwnd) = FALSE THEN EXIT FUNCTION
         ' // Redraws the button in pushed state
         pButton = CAST(CXpButton PTR, .GetWindowLongPtrW(hwnd, 0))
         IF pButton = NULL THEN EXIT FUNCTION
         IF pButton->m_bIsToggle THEN
            IF pButton->m_bToggled = FALSE THEN
               pButton->m_bToggled = TRUE
            ELSE
               pButton->m_bToggled = FALSE
            END IF
         END IF
         pButton->m_fState = BST_PUSHED
         pButton->Redraw
         ' // Redraws the button in unpushed state
         pButton->m_fState = 0
         pButton->Redraw
         ' // Set the focus in the button
         .SetFocus hwnd
         ' // Forwards the message to the parent window
         .SendMessageW .GetParent(hwnd), WM_COMMAND, MAKELONG(GetDlgCtrlId(hwnd), BN_CLICKED), CAST(.LPARAM, hwnd)
         EXIT FUNCTION

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8635
  • Windows 10
    • PlanetSquires Software
Re: CXpButton
« Reply #48 on: July 10, 2018, 05:20:04 PM »

Thanks Jose! I tested it and it seems to be working okay so far  :-)

Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • Moderator
  • Master Member
  • *****
  • Posts: 3109
    • Jos
Re: CXpButton
« Reply #49 on: July 29, 2018, 01:22:37 PM »

Hi Paul,

I have added the ButtonBkColorDown properties to change the background color of the button when it is pressed or toggled.

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8635
  • Windows 10
    • PlanetSquires Software
Re: CXpButton
« Reply #50 on: July 29, 2018, 07:25:20 PM »

Hi Josť,

Thanks for the new code. I added a new Button property called "BackColorDown". Seems to be working okay.
« Last Edit: July 29, 2018, 07:26:51 PM by Paul Squires »
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor
Pages: 1 2 3 [4]