tonghoangvu / DelphiUCL

The new version of Delphi Universal Component Library
102 stars 16 forks source link

UCL.QuickButton question #6

Open srd-software opened 4 years ago

srd-software commented 4 years ago

Would it be possible to use SendMessage instead of WindowState in the Wm_LButtonUp proc? So instead of this:

            qbsMax:
              if not FullScreen then
                begin
                    ParentForm.WindowState := wsNormal
                  else
                    ParentForm.WindowState := wsMaximized;
                end;

Go to something like this:

            qbsMax:
              if not FullScreen then
                begin
                  ReleaseCapture;
                  if ParentForm.WindowState <> wsNormal then
                    SendMessage(ParentForm.Handle,WM_SYSCOMMAND,SC_RESTORE,0)
                  else
                    SendMessage(ParentForm.Handle,WM_SYSCOMMAND,SC_MAXIMIZE,0);
                end;

I sometimes need to intercept the window restore/max messages in my app and if the button uses WIndowState I can't seem to do that.

I was able to work around it by setting the button's ButtonStyle from qbsMax to qbsNone and then add code to the button's MouseUp. But maybe there's a reason for using WindowState?

Thanks. Not a big deal but thought I'd ask about it.

SnowSonic commented 4 years ago

Incorrect «List button» buttons at 200% Screenshot2