Move borderless form using mouse

Has anyone used this technique in Clarion to provide allow movement of a borderless form?

https://www.fluxbytes.com/tag/ht_caption/

It looks like it could be super neat but haven’t had a chance to test it yet.

…posting here as a bookmark but also to see if anyone tries it out before I get to it! :slight_smile:

I have done this in the past. My borderless window requires a region control.

Before Global Includes:

HWND     EQUATE(UNSIGNED)

Inside Global Map

     MODULE('Windows API')
      SendMessage(HWND,UNSIGNED,UNSIGNED,UNSIGNED),LONG,PASCAL,NAME('SendMessageA')
      ReleaseCapture(),BOOL,PASCAL
    END

On the Region control.Accepted:

ReleaseCapture()
lngReturnValue# = SendMessage(0{PROP:HANDLE},161,2,0)  //Please equate these values

Cheers

2 Likes

I have done, the example here: https://github.com/mikeduglas/Script-Player
All browses and forms in school.exe have borders and no standard window captions (replaced by custom captions with custom system buttons and icons).

1 Like

Nice, thanks!

I had a go of it in my ClarionMetroWizard too. I used 'svapi.inc' to get the equates and API:

  INCLUDE('svapi.inc') ,ONCE
  MAP
    INCLUDE('svapifnc.inc') ,ONCE
  END

Note: they don’t have an equate for HTCAPTION though.

ce_MetroWizardForm.TakeEvent  PROCEDURE() !,VIRTUAL
HTCAPTION EQUATE (2)
  CODE
  CASE Field()
  OF SELF.headerRegionFEQ
    CASE EVENT()
    OF Event:MouseDown
      ReleaseCapture()
      SendMessage(0{PROP:HANDLE}, WM_NCLBUTTONDOWN, HTCAPTION, 0);
    END
  END

I am not sure yet if I will bother committing this to the ClarionMetroWizard repo. Currently it works as-is.
I had kind of hoped that this would allow you to move the window around whilst still allowing the windows accept loop to process but I realise now that was not going to happen. Neat technique though!

Back in 2005, I wanted to create a shaped window and had no clue where to start. I cannot remember who it was, but somebody (a clarion veteran) in one of the clarion forum sent me a piece of code that demonstrated how it could be done. I have modified it to my requirement.

The attached sample (its a project and NOT a template generated app) will demonstrate the shaped window as well as the moving this shaped window without the title bar.

ShapedWindow.zip (46.4 KB)

Cheers

1 Like

Very nice, thanks @Mathew!

The pertinent bit being:

OF ?Region:Drag
  ReleaseCapture()
  lngReturnValue# = SendMessage(0{PROP:HANDLE},161,2,0)

My question is, can you achieve the same thing whilst still allowing your ACCEPT loop to process?
Or is the solution to assume the UI thread will get blocked and do any timing related work on separate threads?

The UI thread would be blocked… I have tried it with a piece of code in the timer and it stops whilst the windows is being dragged…

Just checked my solution - it doesn’t block the UI thread, Event:Timer fires while a window is moving. I’m using Window callback/WndProc technology.

Adding:

Window{Prop:Pixels} = 1 ! Change measurements to pixels

Just after the Open(Window) statement may help to have the window size adjusted to the bmp size :slight_smile:

1 Like

Awesome… :thumbsup: