moving tabs/forms (1 Viewer)

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
I have a system where a number of forms can be opened at once.
The user wants to be able to move these to an order he likes.
Is this possible.
So for example form1 is opened. A process then opens form 2 and from here he can open form 3. Each form can be clicked on. We now have a system where there are 3 tabs/forms in the order of (from left to right) form 1, form 2 and form 3. Can the user move form 3 to the far left giving (from left to right) form 3, form 1 and form 2.
 

isladogs

MVP / VIP
Local time
Today, 18:50
Joined
Jan 14, 2017
Messages
18,186
Its not clear whether tabs is referring to tabbed documents (just below the ribbon) or tab controls on a form?

Neither of those can be moved by the end user though the tab control order on a form can be changed using code.

However, its certainly possible to move 3 separate forms on the screen by dragging or to supply code to move the forms to specified positions
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:50
Joined
May 21, 2018
Messages
8,463
If you are talking tabbed documents you can easily fake it. This will make the tabs appear to move. Just hide them and re-show in the order you want.

Code:
Public Sub MoveFarLeft(TheForm As Access.Form)
  Dim frm As Access.Form
  For Each frm In Forms
    frm.Visible = False
  Next frm
  TheForm.Visible = True
  For Each frm In Forms
    frm.Visible = True
  Next frm
  TheForm.SetFocus
End Sub
Public Sub MoveFarRight(TheForm As Access.Form)
  Dim frm As Access.Form
  TheForm.Visible = False
  TheForm.Visible = True
  TheForm.SetFocus
End Sub

Public Sub ReorderForms()
  Dim frm As Access.Form
  Dim i As Integer
  For Each frm In Forms
    frm.Visible = False
  Next frm
  For i = Forms.Count To 1 Step -1
    Forms(i - 1).Visible = True
  Next i
End Sub
 

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
Its not clear whether tabs is referring to tabbed documents (just below the ribbon) or tab controls on a form?

Neither of those can be moved by the end user though the tab control order on a form can be changed using code.

However, its certainly possible to move 3 separate forms on the screen by dragging or to supply code to move the forms to specified positions


I think I mean tabbed documents. If I open a new form I get a tab with the form name in.
 

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
If you are talking tabbed documents you can easily fake it. This will make the tabs appear to move. Just hide them and re-show in the order you want.

Code:
Public Sub MoveFarLeft(TheForm As Access.Form)
  Dim frm As Access.Form
  For Each frm In Forms
    frm.Visible = False
  Next frm
  TheForm.Visible = True
  For Each frm In Forms
    frm.Visible = True
  Next frm
  TheForm.SetFocus
End Sub
Public Sub MoveFarRight(TheForm As Access.Form)
  Dim frm As Access.Form
  TheForm.Visible = False
  TheForm.Visible = True
  TheForm.SetFocus
End Sub

Public Sub ReorderForms()
  Dim frm As Access.Form
  Dim i As Integer
  For Each frm In Forms
    frm.Visible = False
  Next frm
  For i = Forms.Count To 1 Step -1
    Forms(i - 1).Visible = True
  Next i
End Sub
I'm not sure what a tabbed document is. When I open a new form get another Tab. The user ants to drag this tab to a different position. This is similar to opening a new tab on a browser and then dragging it to a new position. IS this what this code does. How is it initiated.
 

isladogs

MVP / VIP
Local time
Today, 18:50
Joined
Jan 14, 2017
Messages
18,186
If you meant tabbed documents as in the attached screenshot, these objects fill the whole screen so my comment about moving forms on the screen doesn't apply.
I never use tabbed documents for that reason but you could try MajP's suggestion.
 

Attachments

  • Capture.PNG
    Capture.PNG
    6.4 KB · Views: 59

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:50
Joined
May 21, 2018
Messages
8,463
can you provide a screenshot? Maybe there is a better user presentation that could be recommended. I also never use tabbed documents. Mostly popup forms.
If you really had to do this, I think faking the drag and drop will be overly complicated and never be as nice as a browser. If I would have to do it I would build a small subform with a few buttons. (Move to beginning, move left, move right, move to end). I would look like a record navigation control. I would put this at the top of each form.
 

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
If you meant tabbed documents as in the attached screenshot, these objects fill the whole screen so my comment about moving forms on the screen doesn't apply.
I never use tabbed documents for that reason but you could try MajP's suggestion.
Yes that's what I meant.
 

isladogs

MVP / VIP
Local time
Today, 18:50
Joined
Jan 14, 2017
Messages
18,186
I would suggest you try using overlapping windows as this gives more flexibility.

However you could suggest adding the ability to drag tabs in tabbed documents via the Access user voice forum. You might hit lucky and get that added in a future update
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:50
Joined
May 21, 2018
Messages
8,463
The code provided and variations of that would then kind of work, but the problem would be the user experience. You may be able to mouse down on one tab and mouse down on a second and have the first tab "appear" to move to the location of the second. I think this could be done, but complicated because you will likely have to build a class module to trap events of multiple forms. Even with all that work you will not get the "drag" effect like in a browser. You could put the code in a custom menu, but if it is buried one level the user is unlikely to use it when it is as easy just to find the location of the existing tab. So my only thought would be to put some controls at the upper left corner of each form so it is always right in front of you. However, you bring up a good point of why this functionality is not built in.
 

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
can you provide a screenshot? Maybe there is a better user presentation that could be recommended. I also never use tabbed documents. Mostly popup forms.
If you really had to do this, I think faking the drag and drop will be overly complicated and never be as nice as a browser. If I would have to do it I would build a small subform with a few buttons. (Move to beginning, move left, move right, move to end). I would look like a record navigation control. I would put this at the top of each form.


yes. hopefully attached
 

Attachments

  • formlayout.jpg
    formlayout.jpg
    89.7 KB · Views: 51

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:50
Joined
May 21, 2018
Messages
8,463
To see the difference between tabbed and overlapping in
Options > Current Database > Document Window Options
You can pick tab or overlapping.

I really do not think the bang for the buck is there with moving the tabs. Faking a tab to move to first or last is simple, the code to move it left or right gets complicated. I think the user interface to do this would not really be worth the saved searching for the correct tab.

If you are not sold on this tab layout, I would recommend the more standard approach to making the db look like a stand alone application. You can download a copy of the MS Northwind sample database to see an example or I am sure there are a tons of links on here. Often you would make a dashboard. This often has several subforms and maybe even some graphs. Usually the information is read only, but you can use it to navigate. It will have a navigation features to get to any form, query, or report that the user would need. Then when you navigate to the next form you pop it up in front of the dashboard. When you close or select home you return back to the dashboard. If you hide the navigation pane and maximize forms you can make it look less like a DB and more like a built application. The functionality tends to be personal so you may want to play with modal forms, sizeable forms, dialog forms, hiding forms, maximized forms, etc. to get the feel you want.
 

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
To see the difference between tabbed and overlapping in
Options > Current Database > Document Window Options
You can pick tab or overlapping.

I really do not think the bang for the buck is there with moving the tabs. Faking a tab to move to first or last is simple, the code to move it left or right gets complicated. I think the user interface to do this would not really be worth the saved searching for the correct tab.

If you are not sold on this tab layout, I would recommend the more standard approach to making the db look like a stand alone application. You can download a copy of the MS Northwind sample database to see an example or I am sure there are a tons of links on here. Often you would make a dashboard. This often has several subforms and maybe even some graphs. Usually the information is read only, but you can use it to navigate. It will have a navigation features to get to any form, query, or report that the user would need. Then when you navigate to the next form you pop it up in front of the dashboard. When you close or select home you return back to the dashboard. If you hide the navigation pane and maximize forms you can make it look less like a DB and more like a built application. The functionality tends to be personal so you may want to play with modal forms, sizeable forms, dialog forms, hiding forms, maximized forms, etc. to get the feel you want.
The user has a system that doesn't do what he wants but he likes the layout.
So he wants me to design something utilising the same layout.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:50
Joined
May 21, 2018
Messages
8,463
As I said, you can easily move a single form to the front or back, but ordering the forms gets real complicated. You have to track externally how everything was opened. Rethinking this, if I had to do this I would build a pop up listbox showing the open forms. And then have up and down buttons to order the forms. That would be a lot easier than tracking the forms. It would work, but I do not see that as a user friendly option. This may be an opportunity to demo other designs to see if they like it.
 

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
As I said, you can easily move a single form to the front or back, but ordering the forms gets real complicated. You have to track externally how everything was opened. Rethinking this, if I had to do this I would build a pop up listbox showing the open forms. And then have up and down buttons to order the forms. That would be a lot easier than tracking the forms. It would work, but I do not see that as a user friendly option. This may be an opportunity to demo other designs to see if they like it.

He, I think, only wants to move forms to the left. He has 1 or 2 that he wants in this position. Is that possible with your code above.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:50
Joined
May 21, 2018
Messages
8,463
Assume you had six opened tabs. On each form you could have a button that says "move first". That is easy using the code provided. If you click on form 6 it will appear at the beginning. The hard part to code is now if you clicked on 5 and did the same. 5 will move to the beginning. The problem is you probably want to see 5,6,1,2,3,4 but my code will give you 5,1,2,3,4,6. The code to keep track of 6 already being moved would be complicated and difficult to synch.

A potential simpler option is a popup form. You could have this on a menu choice or on each form. You select "Order Tabs" and a form with a listbox appears. You then could have up and down arrows to order the tabs. Close the pop up and you could get any order you desire. This is far easier because not tracking and synching movements. Just not sure if this will be to cumbersome.

You could have a combination of both. Movefirst would be easy for the user to get to because it could be a button on top of a form. Order forms would require a few more steps.
 

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
Assume you had six opened tabs. On each form you could have a button that says "move first". That is easy using the code provided. If you click on form 6 it will appear at the beginning. The hard part to code is now if you clicked on 5 and did the same. 5 will move to the beginning. The problem is you probably want to see 5,6,1,2,3,4 but my code will give you 5,1,2,3,4,6. The code to keep track of 6 already being moved would be complicated and difficult to synch.

A potential simpler option is a popup form. You could have this on a menu choice or on each form. You select "Order Tabs" and a form with a listbox appears. You then could have up and down arrows to order the tabs. Close the pop up and you could get any order you desire. This is far easier because not tracking and synching movements. Just not sure if this will be to cumbersome.

You could have a combination of both. Movefirst would be easy for the user to get to because it could be a button on top of a form. Order forms would require a few more steps.

ok i'll take alook in depth and maybe just convince him he only needs 1 form in the left most position!!
actually not sure what I should be doing here
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:50
Joined
May 21, 2018
Messages
8,463
To try it, put a button on your form and on click

Code:
MoveFarLeft Me


Code:
Public Sub MoveFarLeft(TheForm As Access.Form)
  Dim frm As Access.Form
  For Each frm In Forms
    frm.Visible = False
  Next frm
  TheForm.Visible = True
  For Each frm In Forms
    frm.Visible = True
  Next frm
  TheForm.SetFocus
End Sub

All this does is hides all the forms. Shows the desired form first. Then shows all the other forms. The issue is that it does not change the order of the forms in the Forms collection, making it hard to continue to order them.
 

ryetee

Registered User.
Local time
Today, 18:50
Joined
Jul 30, 2013
Messages
952
To try it, put a button on your form and on click

Code:
MoveFarLeft Me


Code:
Public Sub MoveFarLeft(TheForm As Access.Form)
  Dim frm As Access.Form
  For Each frm In Forms
    frm.Visible = False
  Next frm
  TheForm.Visible = True
  For Each frm In Forms
    frm.Visible = True
  Next frm
  TheForm.SetFocus
End Sub

All this does is hides all the forms. Shows the desired form first. Then shows all the other forms. The issue is that it does not change the order of the forms in the Forms collection, making it hard to continue to order them.

Yep works like you say. Will be fine if he only wants one form to the left. I suspect he 'll want 2 or 3. Is there no way to change the order itself in the forms collection.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:50
Joined
May 21, 2018
Messages
8,463
Is there no way to change the order itself in the forms collection.
No, not directly. If you want to move multiple forms left then I would suggest a pop up with a list of forms and the ability to sort the list. Then open in list order.
 

Users who are viewing this thread

Top Bottom