Results 1 to 12 of 12
  1. #1
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423

    Moving Borderless Form Issue

    Trying to have a colored application background via maximized borderless background form and be able to move other borderless forms around on top of it. I've tried 2 different code examples (one API with only MouseDown, the other with MouseDown, Up and Move, no API). The issue is that as soon as the borderless popup form starts to move, a blank area appears at the top just under the quick access toolbar and another large green area moves with the popup. Not sure if that is really what is happening because the white area at the top appears shifted down and left as soon as the popup starts to move then there is a green area that moves moves with the popup. See images:

    grey area at top is quick access toolbar area, right edge is application window
    Click image for larger version. 

Name:	UprCorner1.jpg 
Views:	23 
Size:	1.7 KB 
ID:	37979

    green bar is form image control; top white area appears as soon as form starts to move but does not move with form, right-lower green area moves with form. You can see it aligns with the top of the borderless form. What looks like a border on right side of popup is a box control.


    Click image for larger version. 

Name:	UprCorner2.jpg 
Views:	23 
Size:	2.9 KB 
ID:	37980

    I guess the main question is, has anyone developed a method of moving borderless forms over a colored application area - short of hiding the application window altogether? Or would that be my only option? Have never bothered to hide app window, and suspect that any "background" form would behave same as it does here. If you're asking "why", I'd say it's because you don't use Access 2016 or later - the built in form border is crap. Or you don't mind it.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Hi Micron

    I've not experienced your issues but may not have ever tried exactly what you are doing.

    I think it would be very helpful to others if you uploaded an example database showing the issue.
    Can you include the 2 methods you have for moving borderless forms.

    I dislike the 2016 interface with a passion for many reasons (form border width, blinding white background, QAT toolbar icon difficult to distinguish etc)
    For those reasons and many more, I continue to develop in A2010. Anyway that's beside the point

    In case it helps, the latest version of Access 365 include black & dark grey colour themes which include dark backgrounds.
    Alternatively a DEMO by AWF member allows you to set your own background colour & maximise it
    That may be the same as you have now but possibly worth a look: https://www.access-programmers.co.uk...d.php?t=300821

    Borderless forms are great except that they can't normally be dragged around the screen.
    As you have solutions for that, I'm sure that would help others

    As for hiding the application interface, normally you then have forms 'floating on the desktop' though the background can be hidden
    Two of my demos that may be worth looking at: Control the Application Interface , An Attention Seeking Database (Remove Background item)
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    My guess is that default form design of A2016 doesn't carry over to A2010 or maybe 2013?
    Have recreated the issue with different db, which behaves the same. I figured out that the right side white area is the underlying form width being resized. I suspect that simply making it wider so that it is the same width as my screen would work for me, but different monitor resolutions could expose the same behaviour or worse. So if one doesn't see the white area on the right, the form width is probably the same or greater than the monitor width. In that case, make it smaller and try again.

    I know of your method to hide the application window (but haven't looked into it) for this project as I was intending to make use of a customized ribbon (you may recall prior posts from me about that) so I assume the app window is required in order to use the ribbon. Maybe there is a way to replicate the look of customized ribbons without the app window?

    Thanks for taking a look. I'll look into your links shortly, just to be sure I'm not missing something.
    There is an automacro to open form2; form1 is set to open by setting it as the opening form in options.

    AForumTest.accdb

  4. #4
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    I also have A2016.
    I've just tested it in A2010 and get the same strange effect.
    Even so I'm going to steal your movable form code as in A2010 there is no need for Form1.
    I'd like to use it in the form header. Looks like it should work.

    I'll have a look into the issue later but in the meantime do try Frothingslosh's demo coloured background in case that solves your issue.
    Similarly do try the dark themes in A2016/365 as you could then scrap Form1
    Removing the application window means no ribbon and no QAT.
    It also requires forms to be popup
    You could of course replicate a ribbon with suitable form buttons - possibly in the form header?
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  5. #5
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Tried the grey and black for all of 2 minutes - total. How M$ could think that anyone would consider that a permanent solution is beyond me. If you're going to add 2 versions of no colour why stop there? Their motto must be "If it ain't broke, let's break it."
    That code seems to work but I'd need more active forms/report/queries to know for sure. Right now I'm testing various things and don't have one db containing all of the test items in it. Right now I'm leaning towards a custom ribbon so hiding the app window isn't an option at this point. A.D. Kallal posted a class module that's makes assigning ribbon button attributes fairly simple. Seems I forgot to include the source url in my project, so I don't have that handy.

    As for stealing, it's not my code 'cause I 'borrowed' it too. I think the 3 mouse events came from dbguy at AWF.
    The other is from https://it.toolbox.com/question/move...ss-form-022510 about the 4th post down.
    I'll consider this one solved. Thanks again.

  6. #6
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    You responded whilst I was testing it....

    As you've already discovered, Frothy's background form solved the issue which is what I expected.

    Using your original version, I changed the background Form1 to bright green & immediately realised the problem
    Form1 wasn't being shown at all as Form2 was covering the whole screen....
    ...until you dragged Form2 when you exposed Form1 ...but its not maximised.

    The solution with your original code is simple. Change Form2 to popup - as attached.
    Change it back to 'normal' and you'll see what I described in paragraph 2

    I also scrapped both Black & dark grey themes very quickly. Not to my liking
    The only reason I lasted as long as 2 days is that I use A2010 almost 100% of the time

    EDIT:

    1. Just tested with the mouse move/down code in the form header & on a label in the header section.
    It works perfectly! Going to add this code to a couple of my example apps which have borderless forms
    Thanks

    2. I tried the API version on another form but it didn't work for me - it just popped up the hwnd value for the form
    However this did work for me:

    Code:
    Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    
       X = ReleaseCapture()
       X = SendMessage(Me.HWnd, WM_NCLBUTTONDOWN, HT_CAPTION, 0)
    End Sub
    I've updated the API code so its compatible with both 32-bit & 64-bit.
    v3 attached using the modified API code.
    This time the code is in the form header
    Attached Files Attached Files
    Last edited by isladogs; 04-02-2019 at 01:54 PM. Reason: Added additional attachment & more detail
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Something wrong with what you're saying because the images I posted last night were where the top form was popup
    The issue is that as soon as the borderless popup form starts to move
    I simply forgot that property in the uploaded db.
    Form2 was covering the whole screen.
    Not in my version. If form1 is maximized (which it is set to do if you just open the db) form2 should display sized as designed. If form1 isn't maximized, form2 probably would appear smaller (restored size). Perhaps you see form1 as not maximized because your screen is wider than mine, or you opened the db as bypassed, which I said not do to. The form size was somewhere around 11", which is big enough for my screen but perhaps not for you if it didn't open normally first. If form2 wasn't maximized, then form1 wasn't either since all forms will follow the window size mode when not opened in a specific manner. If form2 opened maximized for you, then something went wrong in opening the db, or maybe your security settings didn't allow the macro to run. Did you allow the forms to open as designed, or did you bypass on open?

    Check the code. I may have inadvertently left something commented out when I flipped from API to Mouse events. I do recall a message box for seeing if the Hwnd was a number or what. It's not necessary. Any form section that has an event is supposed to call the public sub, but don't leave both Mouse and API code enabled.

  8. #8
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    UPDATE: the posted db is missing some of the code for the API. Sorry. In MouseDown event for the form section or control (detail section shown):

    Code:
    Private Sub Detail_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim Handle As Long
    
    X = ReleaseCapture()
    Handle = Me.HWnd
    MoveForm X, Handle
    
    End Sub
    Don't forget the public sub (so that same API can be called from any form, any control that accepts MouseDown event)
    Code:
    Sub MoveForm(X, Handle)
    X = SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0)
    End Sub
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    As I mentioned before I wa testing in A2010 as the behaviour matched what you had described
    I tried yours on a 22 inch monitor and a 10 inch tablet - same result in both cases.
    Other than using A2010, I followed your instructions exactly. I also downloaded a fresh copy to ensure I hadn't changed anything else
    Whatever it should do ...it actually does what I described using A2010
    There is nothing in my setup which altered any code at all regarding form size

    This screenshot is another fresh copy of your download but this time opened in A2016 with no changes done by me
    For me it has different behaviour in A2016 BUT Form1 still isn't maximised once Form2 opens

    Click image for larger version. 

Name:	Capture.jpg 
Views:	15 
Size:	70.6 KB 
ID:	37990
    Interestingly dragging Form2 doesn't create the weird effect in A2016 whether or not its a popup
    BUT the background stayed where it was covering a small part of the screen only

    Try my attachment (v2) from my previous reply & hopefully you'll see what I mean
    As I said your original version worked for me in A2010 when I restored the popup property

    As a standard form it does this in A2010:

    Click image for larger version. 

Name:	Capture2.jpg 
Views:	14 
Size:	72.8 KB 
ID:	37993

    With Frothy's background form, it also works perfectly as a standard form in A2010
    I've also added a further attachment (v3) to the previous post using the API adapted to work in 32 or 64-bit.
    You had left an Hwnd message box which I disabled after posting but the API mouse move code only worked for me when placed in the form

    I'm happy anyway. I now have 2 different methods of moving a borderless form so thanks for finding the code.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  10. #10
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Posts are crossing. Previous answer written before seeing your latest reply.
    As I said, your original version doesn't work for me in A2010 or A2016 unless I use popup
    Using Frothy's background form, it works as a standard form or popup
    .
    I'd already sorted the API code - see earlier reply and attachment.
    However, just checked your revised version which of course also works.
    Both your method & mine amount to much the same code in the form
    Thanks again
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  11. #11
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Looks to me like your screen width is the problem (aside from me forgetting to put popup on the test db form). Proportionally, the forms look the same to me, but you have a lot of white space because (I think) of the form size is too small for your monitor. I bet if you made it around 18 - 20" in width, it would be a different story. 11 is wide enough for my laptop.

    Anyway, I've already marked as solved and I'm happy with the other solution for now. I will probably experiment with it to see if it can be amalgamated somehow unless 3 mouse events is all that's needed for the whole form. I wouldn't want to have to do that for a header, detail and footer sections. Also, if one mouses down over a label I'm mildly certain the label (or any control) won't run the necessary mouse event so you won't be able to drag.

  12. #12
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    NoI don't believe that's the case

    Before my first reply, I had also tried increasing the size to match my monitor.
    Don't forget I also tried on a 10 inch tablet where your form was larger than the screen.

    When I disabled Form2 opening, Form1 is maximised in A2010 BUT NOT in A2016. Go figure!
    When I then open Form2 manually, Form1 disappears in A2010. In A2016 its as in my previous screenshot

    Your background form would I think have worked perfectly using my form resizer code but I honestly don't want to spend more time checking this.

    You & I get different outcomes with the same app.
    We both have a working version even though they aren't quite identical

    However, it appears you haven't looked at either of my files from post #6 (still 0 views)
    It would be helpful if you would try both of my uploads & see if they behave correctly for you
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Moving a form from one database to another
    By Lou_Reed in forum Access
    Replies: 2
    Last Post: 06-02-2015, 11:45 AM
  2. Replies: 22
    Last Post: 05-21-2013, 07:54 PM
  3. Replies: 1
    Last Post: 12-12-2011, 01:58 PM
  4. Things moving around on my form
    By jlm722 in forum Forms
    Replies: 0
    Last Post: 09-30-2009, 03:34 PM
  5. Moving Information from One Form to Another
    By bsharpbyoung in forum Forms
    Replies: 2
    Last Post: 03-22-2009, 09:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums