Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup Position 2

Status
Not open for further replies.

Domino2

Technical User
Jun 8, 2008
475
GB
I did a forum search, tried an example and my popup dissapeared. I tried changing to moveto position but still could not find it. I have 3 questions.

1. How can I set the position and size of a popup form having no border (trying to integrate it on a form)

2. Is there a way to keep it visible when clicking other controls (without a lot of flickering appearances) I cannot make it a modal, as the popup contains a listbox and controls and needs to be visible at all times but allow users to go anywhere on the mainform without it closing.

3) Can a popup be externally closed?, ie not a command button in the popup forms footer

Any suggestions, thanks
 
Thanks Remou for the suggestion, I gave it a try but it opened up again, probably due to being referenced somewhere in the subform. However the mainform has a footer where certain controls residing on the mainform have to be visible.
 
Last gasp, movesize the main form to fit and put it back to the right size and position when you are done.
 
Thanks Remou, I did try movesize on the mainform before opeing the subform but nothing seemed to happen, I was possibly not getting the focus to the form in question. Will have another crack at it.
 
how about

in the onopen event of your pop up form

me!mainform.visible = false

and then in your close event of your pop up form

me!mainform.visible = true
 
Thanks again. I will have to relook at it, as when the popup form makes the mainform hide, it takes away the subform from view as well just leaving the popup on the screen. Do you have to set focus to a form before you can use Movesize?, as if I can keep my mainform open but resize it that would be more ideal. How long is a gasp?
 
Yes, you will have to set focus before you movesize as it works on the active form.
 
Tried everything in the book to resize,movesize etc but my mainform won't budge. In design mode of course you cannot alter the size beyond where controls are mounted. I removed all the docmd.maximise statements I had in the form as well as calls in the resize event to maximize, as if a user mouseclicked on the border of the mainform it would drop down the screen. Think I've had it, wish I could thank BG. Regards
 
OK. While you're in the form... adjust the size of the form to the size you want and then... move one of your text boxes one space to the left. When you are prompted to save click Yes. test
 
The mainform is already set to size and position, it's very populated so it would be a major job to consider putting everything in the corner and then coding their final positions. If I cannot movesize it as it is then my quest is over and the hangmans noose comes out!
 
Last Call!! I can get things to work if I start with a normal form for my mainform, a popup for my subform, and an ordinary form as a popup. However how can I get rid of the Access window when my form opens so my application covers up to the top without making it a popup?
 
Hey Domino, how are ya? There is a FAQ on here that gives you step by step instructions on how to do that. It's really simple and it works great. I had an issue with opening reports so if you need help with that let me know. Good luck!

FAQ ON HIDING THE ACCESS WINDOW:

 
Many thanks. However the bit I wanted to remove was the top of every form that allows people to roam, commandbars. I found this reference to a site which contains some good references to what I was looking for. I hope you and others find something in it. Regards

 
I found even more code just up my street. It removes the exit button, max/min buttons etc from Access application title bar. Yipeee, I am nearly home and dry with my problems. Hope this code helps others in their plight. Many thanks to whoever produced it.

Paste the following code into a module, then call it with
Call Buttons(false)
To turn them off and
Call Buttons(True)
to turn them on

********** Code Start *************
Option Explicit

Private Const GWL_STYLE = (-16)
Private Const WS_CAPTION = &HC00000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_SYSMENU = &H80000


Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOZORDER = &H4
Public Const SWP_FRAMECHANGED = &H20

Private Declare Function GetWindowLong _
Lib "user32" Alias "GetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long _
) As Long

Private Declare Function SetWindowLong _
Lib "user32" Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long _
) As Long

Private Declare Function SetWindowPos _
Lib "user32" ( _
ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long _
) As Long
' **************************************************
'

Function AccessTitleBar(Show As Boolean) As Long
Dim hwnd As Long
Dim nIndex As Long
Dim dwNewLong As Long
Dim dwLong As Long
Dim wFlags As Long

hwnd = hWndAccessApp
nIndex = GWL_STYLE
wFlags = SWP_NOSIZE + SWP_NOZORDER + SWP_FRAMECHANGED + SWP_NOMOVE

dwLong = GetWindowLong(hwnd, nIndex)

If Show Then
dwNewLong = (dwLong Or WS_CAPTION)
Else
dwNewLong = (dwLong And Not WS_CAPTION)
End If

Call SetWindowLong(hwnd, nIndex, dwNewLong)
Call SetWindowPos(hwnd, 0&, 0&, 0&, 0&, 0&, wFlags)
End Function


Function Buttons(Show As Boolean) As Long
Dim hwnd As Long
Dim nIndex As Long
Dim dwNewLong As Long
Dim dwLong As Long

hwnd = hWndAccessApp
nIndex = GWL_STYLE

Const wFlags = SWP_NOSIZE + SWP_NOZORDER + SWP_FRAMECHANGED + SWP_NOMOVE
Const FLAGS_COMBI = WS_MINIMIZEBOX Or WS_MAXIMIZEBOX Or WS_SYSMENU

dwLong = GetWindowLong(hwnd, nIndex)

If Show Then
dwNewLong = (dwLong Or FLAGS_COMBI)
Else
dwNewLong = (dwLong And Not FLAGS_COMBI)
End If

Call SetWindowLong(hwnd, nIndex, dwNewLong)
Call SetWindowPos(hwnd, 0&, 0&, 0&, 0&, 0&, wFlags)
End Function
 
The top of every form? I think you can do that in the form properties and/or Access program properties. Glad you solved your problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top