chestera
asked on
Scheduler expand text box question
Hi EE
I have built a small monthly scheduler using the following code
Private Sub t1_GotFocus() -----------Got Focus
FW = t1.Width
FH = t1.Height
Me.t1.Width = 5000
Me!t1.Height = 3000
End Sub
Private Sub t1_LostFocus() ----------Lost Focus
Me.t1.Width = FW
Me!t1.Height = FH
End Sub
Private Sub t10_Click() --------------------On Click
Me!txtDays = Controls("d" & 10).Value
Me!txtInfo = "10"
End Sub
The text box's expand from left to right. When I select the last box on the right hand side of the screen there isn't any room for the Box to expand. My question, is it possible to reverse the expansion Right to left. Any help appreciated
chestera
I have built a small monthly scheduler using the following code
Private Sub t1_GotFocus() -----------Got Focus
FW = t1.Width
FH = t1.Height
Me.t1.Width = 5000
Me!t1.Height = 3000
End Sub
Private Sub t1_LostFocus() ----------Lost Focus
Me.t1.Width = FW
Me!t1.Height = FH
End Sub
Private Sub t10_Click() --------------------On Click
Me!txtDays = Controls("d" & 10).Value
Me!txtInfo = "10"
End Sub
The text box's expand from left to right. When I select the last box on the right hand side of the screen there isn't any room for the Box to expand. My question, is it possible to reverse the expansion Right to left. Any help appreciated
chestera
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Slight modification to what mbizup posted so that the right side of the textbox stays in place.
Private Sub t1_GotFocus() '-----------Got Focus
FW = t1.Width
FH = t1.Height
FL = t1.Left
Me.t1.Width = 5000
Me!t1.Height = 3000
Me.t1.Left = FL - (Me.t1.Width - FW)
End Sub
Looks like Miriam already corrected herself.
:-)
:-)
:-)
I figured having the textbox visibly scooting around the screen would drive the users to distraction.
I figured having the textbox visibly scooting around the screen would drive the users to distraction.
Maybe it will seem like a game. Much better if you move the textbox around when the mouse approaches.
;-)
;-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
irogsinta
Than you for that Advice was going to change to call a function
chestera
Than you for that Advice was going to change to call a function
chestera
ASKER
mbizup
Thank you for that
chestera
Thank you for that
chestera
Miriam,
I want to see what you did but I only have 2007.
:-(
I want to see what you did but I only have 2007.
:-(
Ron,
I've updated my comment with it in .mdb format.
I've updated my comment with it in .mdb format.
Thanks Miriam,
I'll check it tonight when I get home. I'm up in Richmond for my son's gymnastic competition.
I'll check it tonight when I get home. I'm up in Richmond for my son's gymnastic competition.
Woot! Have fun with that.
It sounds like we might be neighbors.
It sounds like we might be neighbors.
ASKER
IrogSinta
Hope this is not out of order it now works fine right hand of the screen going right to left. I have now been trying to figure out how to change from Top to Bottom to bottom to Top. This is for the the last text box's at the bottom of the screen
regards
Alan
Hope this is not out of order it now works fine right hand of the screen going right to left. I have now been trying to figure out how to change from Top to Bottom to bottom to Top. This is for the the last text box's at the bottom of the screen
regards
Alan
ASKER
mbizup
I have 31 box's on the screen representing the 31/30 days of the month (28 for Feb) they are quite small (Enough to put a heading for the reminder) when the user click on a day that box it expands to a large size so user can read/Add text. the field in the tbl is a memo field so thwer is no restriction on the amount of text ie 255 characters. Would you expand the box as the mouse movers over the box rather than click on the box
Thank you for your comment
Alan
I have 31 box's on the screen representing the 31/30 days of the month (28 for Feb) they are quite small (Enough to put a heading for the reminder) when the user click on a day that box it expands to a large size so user can read/Add text. the field in the tbl is a memo field so thwer is no restriction on the amount of text ie 255 characters. Would you expand the box as the mouse movers over the box rather than click on the box
Thank you for your comment
Alan
Responding, borrowing Ron's code because I'm right here...
Something like this:
Private Sub ExpandMe(ExpandUp as Boolean, expandLeft As Boolean)
Dim ctl As Control
Set ctl = Me.ActiveControl
FW = ctl.Width
FH = ctl.Height
FL = ctl.Left
FT = ctl.Top
ctl.Width = 5000
ctl.Height = 3000
If expandLeft Then ctl.Left = FL - (Me.t1.Width - FW)
If expandUp Then ctl.Top = FT - (Me.t1.Height - FT)
End Sub
Something like this:
Private Sub ExpandMe(ExpandUp as Boolean, expandLeft As Boolean)
Dim ctl As Control
Set ctl = Me.ActiveControl
FW = ctl.Width
FH = ctl.Height
FL = ctl.Left
FT = ctl.Top
ctl.Width = 5000
ctl.Height = 3000
If expandLeft Then ctl.Left = FL - (Me.t1.Width - FW)
If expandUp Then ctl.Top = FT - (Me.t1.Height - FT)
End Sub
Honestly, I would not bother with the expansions.
Have you tried Access's built-in ZoomBox feature?
Click on a control and hit Shift-F2 if memory serves me right.
Have you tried Access's built-in ZoomBox feature?
Click on a control and hit Shift-F2 if memory serves me right.
I noticed a mistake in my code. Just change this part as well.
If expandLeft Then ctl.Left = FL - (ctl.Width - FW)
If expandUp Then ctl.Top = FT - (ctl.Height - FH)
If expandLeft Then ctl.Left = FL - (ctl.Width - FW)
If expandUp Then ctl.Top = FT - (ctl.Height - FH)
Something I have done in my own databases with similar issues (such as continuous forms with limited space with textboxes bound to memo fields) is to add this to the double-click event of any memo fields:
and simply instruct the users to double click the textbox if they want to enter text or see all the data in the field.
Docmd.runcommand accmdZoomBox
and simply instruct the users to double click the textbox if they want to enter text or see all the data in the field.
ASKER
mbizup
Many thanks for your help most appreciated. Re using the expansion I am using access 2003 so assume you are talking about 2010.
Alan
Many thanks for your help most appreciated. Re using the expansion I am using access 2003 so assume you are talking about 2010.
Alan
ASKER
IrogSinta
Thank you again most appreciated
Alan
Thank you again most appreciated
Alan
ASKER
IrogSinta
Sorry to trouble you again. Not quite sure about the If statement
If expandLeft and the If expandUp should there be a value in variable the expandleft and up
Alan
Sorry to trouble you again. Not quite sure about the If statement
If expandLeft and the If expandUp should there be a value in variable the expandleft and up
Alan
Chestera,
I was actually not specifically referring to 2010. The zoom box and that code should work in 2003
I was actually not specifically referring to 2010. The zoom box and that code should work in 2003
ASKER
mbizup
Ok thank you. Didn't know it existed
Alan
Ok thank you. Didn't know it existed
Alan
Chestera,
Here's what it should look like:
Here's what it should look like:
Private Sub ExpandMe(Optional expandUp as Boolean, Optional expandLeft As Boolean)
Dim ctl As Control
Set ctl = Me.ActiveControl
FW = ctl.Width
FH = ctl.Height
FL = ctl.Left
FT = ctl.Top
ctl.Width = 5000
ctl.Height = 3000
If expandLeft Then ctl.Left = FL - (ctl.Width - FW)
If expandUp Then ctl.Top = FT - (ctl.Height - FH)
End Sub
Private Sub ShrinkMe()
Dim ctl As Control
Set ctl = Me.ActiveControl
ctl.Width = FW
ctl.Height = FH
ctl.Left = FL
ctl.Top = FT
End Sub
Most of your controls should use
Call ExpandMe
Controls on the right should use
Call ExpandMe(,True)
Controls on the bottom should use
Call ExpandMe(True)
The control on the bottom right that needs to expand left and up should use:
Call ExpandMe(True,True)
Miriam,
You did have time on your hands. Cool beans!
:-)
You did have time on your hands. Cool beans!
:-)
ASKER
mbizup
Yep it worked Shift F2. Learn something new every day
Alan
Yep it worked Shift F2. Learn something new every day
Alan
ASKER
IrogSinta
Yep got that. Many thanks again. You went above and beyond the question much appreciated.
Alan
Yep got that. Many thanks again. You went above and beyond the question much appreciated.
Alan
-->> Learn something new every day
Ain't it great?
The database I use that in is a Discrepancy Report Database with a mainform/subform setup. The mainform shows the main trouble report; the subform displays all of the actions taken towards resolving the problem. The users wanted to see the actions as a list... so that they could quickly see and enter information such as date, stats and description. The description field however could be huge... and to keep it looking okay in a continuous subform, we could only display a small portion of the text.
So that zoombox was perfect, with the double-click event code "DoCmd.RunCommand acCmdZoomBox" (which is the VBA equivalent of Shift F2)
Ain't it great?
The database I use that in is a Discrepancy Report Database with a mainform/subform setup. The mainform shows the main trouble report; the subform displays all of the actions taken towards resolving the problem. The users wanted to see the actions as a list... so that they could quickly see and enter information such as date, stats and description. The description field however could be huge... and to keep it looking okay in a continuous subform, we could only display a small portion of the text.
So that zoombox was perfect, with the double-click event code "DoCmd.RunCommand acCmdZoomBox" (which is the VBA equivalent of Shift F2)
ASKER
mbizup
Thank you for all your help all the best
Alan
Thank you for all your help all the best
Alan
Open in new window
Open in new window