How to Open Form in Same Location as Already Open Form? (1 Viewer)

JMongi

Active member
Local time
Today, 06:52
Joined
Jan 6, 2021
Messages
462
@isladogs - Colin, I'm pinging you since I'm using your window moving/sizing functions.

In navigating my application, I would like it to appear as if the application is altering even though in reality I'm opening and closing forms.
This should be doable if I open the new "alteration" on top of the existing form and then close the existing form. Since I believe Colin's code is tracking the window location (in order to simulate the window header mouse drag), I should be able to use similar location data to open my new form at that exact location. Using the Windows API calls in this way is definitely a strong learning curve which is why I'm not posting any relevant attempts at this point.
 

isladogs

CID VIP
Local time
Today, 11:52
Joined
Jan 14, 2017
Messages
14,991
I'm sorry but I don't understand what you are asking me.

First of all, please give a link to the code of mine you are using as I'm not a mind reader
Secondly, how exactly do you want it to appear that your application is altering when you are just opening & closing forms?

Perhaps a screenshot or two will help even if you don't have any worthwhile code to look at....
 

JMongi

Active member
Local time
Today, 06:52
Joined
Jan 6, 2021
Messages
462
@isladogs - Got it, sorry to be confusing.
Here is the code I am using on my forms.

As far as what I would like to happen, here is the main navigation form.
OpDB.PNG

Clicking on Maintenance Connect should bring up this form.

MaintConnect.PNG


I would like the maintenance connect form to open up on top of the operations form no matter where the operations form is on the screen.
 

Isaac

Lifelong Learner
Local time
Today, 03:52
Joined
Mar 14, 2017
Messages
5,386
Wouldn't this all be a million times easier if you just set your forms to auto center property to Yes? I think that is what many people do?
 

JMongi

Active member
Local time
Today, 06:52
Joined
Jan 6, 2021
Messages
462
That's the plan. Thanks for the link. I'll read up.
 

JMongi

Active member
Local time
Today, 06:52
Joined
Jan 6, 2021
Messages
462
Wouldn't this all be a million times easier if you just set your forms to auto center property to Yes? I think that is what many people do?
If I didn't want/allow them to move the form around the screen wherever they wish, that would definitely be true.
 

isladogs

CID VIP
Local time
Today, 11:52
Joined
Jan 14, 2017
Messages
14,991
You can prevent them moving the form by setting the border style to none.
Whilst the example app you've looked at shows a way around that, it is only possible to move borderless forms using added API code.

BTW I also have an article showing how to centre forms both horizontally and vertically
 

JMongi

Active member
Local time
Today, 06:52
Joined
Jan 6, 2021
Messages
462
Thanks for all of the help. To clarify:
1. I WANT the user to be able to move the form around like any other window.
-That's why I used Colin's sample code posted above. I have the added API code in the form headers to move it around.

2. I still want the app forms to layer on top of one another where appropriate to the design.
-This would require pulling the current form location data and feeding it to the soon to be opened form. It appears that Colin's second link should handle that nicely with the caveat that some functionality may not work with the app window minimized/hidden like I'm doing. I don't think it will be an issue with just pulling the form location, but I'm not 100% sure.

Since this is this companies first foray into a DB application I want to make it as user friendly as possible and I already got feedback that they want this type of functionality.
 

isladogs

CID VIP
Local time
Today, 11:52
Joined
Jan 14, 2017
Messages
14,991
Yes the code in the second link should allow you to do this. You may need to temporarily switch off screen updating to prevent/minimise flicker whilst changing forms
 

Users who are viewing this thread

Top Bottom