Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-access > #10182
| From | Ulrich Möller <knobbi38@arcor.de> |
|---|---|
| Newsgroups | comp.databases.ms-access |
| Subject | Re: Postitioning a control in a form |
| Date | 2014-12-11 00:56 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <m6amj1$618$1@dont-email.me> (permalink) |
| References | <b76f269d-5fc0-4ce3-88d5-845de07d521e@googlegroups.com> <19e8276f-d311-4058-9c07-fe205be791ac@googlegroups.com> <m6a5qe$268$1@dont-email.me> <8bbbfc1c-837b-4b95-89c1-6543e27752b8@googlegroups.com> |
Am 10.12.2014 um 22:53 schrieb Patrick Finucane:
> On Wednesday, December 10, 2014 2:10:28 PM UTC-5, Ulrich Möller wrote:
>> Am 10.12.2014 um 16:20 schrieb Patrick Finucane:
>>> On Tuesday, December 9, 2014 6:27:45 PM UTC-5, Patrick Finucane wrote:
>>>> Hi. I have a form, Form1, that has a box/rectangle control. I call it Box0.
>>>>
>>>> I want to open a form, Form2, and position it at the Top Left coordinate of Form1's Box0. I think I may have the placement of that issue licked, maybe not.
>>>>
>>>> Anyway, when Form2 is displayed, I may resize it within Box0. At this point I can get the various coordinates of Form2 using WindowLeft, WindowTop, WindowHeight, and WindowWidth. Ex: lngLeft = Me.WindowLeft
>>>>
>>>> Inside Form2 I have 2 controls; LabelW and LabelL (for length and width). I need to display LabelW in the middle of Form2's display and LabelL at the bottom of Form2. What I would normally consider an easy task is turning into frustration. How can I get LabelL to print/display just above the bottom of the form using VBA? How can I display LabelW so it displays halfway down the display area of Form2. Is there some way of doing so? Currently I'm doing things like
>>>> Me.LabelL.Top = Me.WindowHeight - 360
>>>> In the above line, I would think LabelL would display 1/4" (360) from the bottom of Form2.
>>>>
>>>> For some odd reason the WindowHeight of Form2 has no correlation with the height of the detail section in Form2. The detail section is a large number using the Design view setting of the height.
>>>>
>>>> At this point I don't know if using Move is the way to go or the setting of a control such as LabelL.Top = ...
>>>>
>>>> This should be really easy to do. But I'm lost.
>>>>
>>>> Btw, I am using A2013 and have it set to use Overlapping Windows, not tabbed documents.
>>> I think it may be best to provide some code. Make it easy to test. Forms are Overlapping
>>>
>>> I have Form1, sizable, no title caption, no record selector, no nav buttons.. It contains Box0 in Detail section.
>>>
>>> I have Form2, sizable, no title caption, no record selector, no nav buttons, type Dialog. It contains 2 labels in Detail; LabelW and LabelL. I want LabelW to be in the MIDDLE of Form2, LabelL at bottom of Form2.
>>>
>>> At issue, LabelL is lower than bottom of Form2 after running code thus unseen
>>>
>>> The following is my code contained in Form1
>>> Private Sub Form_Current()
>>>
>>> Dim lngTop As Long
>>> Dim lngBottom As Long
>>>
>>> DoCmd.OpenForm "Form2", acNormal
>>> Forms!Form2.SetFocus 'form2 is set to dialog. Places on top of form1
>>>
>>> 'now move Form2 to Box0 coordinates. Height of form 1.5 inches
>>> Forms!Form2.Move Left:=Me.Box0.Left, Top:=Me.Box0.Top, Height:=Me..Box0.Height / 2, Width:=Me.Box0.Width - 100
>>>
>>> 'reset detail height of Form2 set in design mode
>>> Forms!Form2.Detail.Height = Me.Box0.Height / 2
>>>
>>> 'determine middle of Form2 for LabelW position
>>> lngTop = Forms!Form2.WindowHeight / 2 - 600 'top for LabelW, middle of form
>>> 'determine bottom of Form2 for LabelL position
>>> lngBottom = Forms!Form2.Detail.Height - 40 - 600 'top for LabelL, bottom of form
>>>
>>> Forms!Form2!LabelW.Top = lngTop 'should be middle of form
>>> Forms!Form2!LabelL.Top = lngBottom 'should be bottom of form
>>> End Sub
>>>
>>> Private Sub Form_Load()
>>> 'Set Box0 to 3 inches by 5 inches
>>> DoCmd.Maximize
>>> Me.Box0.Top = 1440
>>> Me.Box0.Left = 1440
>>> Me.Box0.Height = 1440 * 3 '3 inches
>>> Me.Box0.Width = 1440 * 5 '5 inches
>>> End Sub
>>>
>>> Private Sub CommandClose_Click()
>>> 'close my windows
>>> If IsLoaded("Form2") Then
>>> DoCmd.Close acForm, "Form2"
>>> End If
>>> DoCmd.Close acForm, Me.Name
>>> End Sub
>>>
>>> Can you help me figure out how to get LabelL to the bottom of Form2 and visible?
>>>
>> Hi Patrik,
>>
>> Positioning Form2 to fit in the rectangle on form1 can be done with some
>> api calls, but you have to fiddle arount with absolute and relative
>> coordinates, transform twips coordinates to pixels coordinates and so on.
>> The detailsection.height should be set iin the form2 resize event. It is
>> calculated as forms2.insideheight -footer.height -header.height.
>> To let the LabelL flow relative to the bottom of form2 set the vertical
>> anchor property of the label to "bottom".
>>
>> It is not quite plain to me why you want to do this and why you want to
>> open form2 in design view. Perhaps there is an easier solution for what
>> you want to achieve.
>>
>> Ulrich
> I did an app 20+ years ago in FoxPro DOS for a firm that cuts sheetstock. One crucial part of the app was creating the cutting charts. A Base-line window was displayed. That would represent the board size; ex 50"x100". The op would select parts to cut with this board. Let's say 1 line item was 48"x20#. A square (window) was put in the baseline. The op could resize it to represent the part. Then he'd select another part, maybe 22"x76". I'd drop a new form and the op would resize it. Then a third line item, 24"x75" to complete the chart. The op would resize form3. Now, if the op wants to look at history of charts, the base form or the chart just described would be displayed with the 3 forms contained in it. I needed the ability to resize these items. Can't be done unless in design more. Can't mix design mode with open mode. So doing it like I did in FoxPro 20 years ago seemed the most doable.
>
> This is all done to produce a graphical representation of the board being cut. It is also crucial it be done like this...per the boss. He wants the height displayed in the middle of the window on the left side and the length displayed at the bottom of the window in the middle of it. It's the way it's been done 20 years and the cutters are used to that representation. If I can't do this there is no reason to upgrade from FoxProDos to Access 2013. Doing this in FoxPro years ago was much easier than doing it in Access.
>
> Bt
Hi Patrick,
I would not want to make this with Access. There are some other tools
that may be a better choice because access controls a optimized for
database application and have therefor some restrictions. Nevertheless,
if you must use Access for some reason you can give the accessnetview
control a chance.It can be embedded in your form and it should be
possible to do what you want (see.the playground example). Another idea
wold be to integrate a webbrowsercontrol and interact with the html5
canvas and some shapes on it. I 'll think, that it is possible to give
your application a very good new look and a great and easy ui for your
users with these tools.
To use forms, especially in design view might not be the best solution,
because you would loose control over user inputs and other terrible
things that could happen.
Another idea is what Ron mentioned or even easier to use "userforms",
but i don't know if there are still supported in ACC2013.
many greets
Ulrich
Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Postitioning a control in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-12-09 15:27 -0800
Re: Postitioning a control in a form Ulrich Möller <knobbi38@arcor.de> - 2014-12-10 03:32 +0100
Re: Postitioning a control in a form "Ron Paii" <None@none.com> - 2014-12-10 07:29 -0600
Re: Postitioning a control in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-12-10 06:14 -0800
Re: Postitioning a control in a form "Ron Paii" <None@none.com> - 2014-12-10 11:29 -0600
Re: Postitioning a control in a form Dave W <davewi11@yahoo.co.uk> - 2014-12-13 11:12 +0000
Re: Postitioning a control in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-12-10 07:20 -0800
Re: Postitioning a control in a form Ulrich Möller <knobbi38@arcor.de> - 2014-12-10 20:10 +0100
Re: Postitioning a control in a form Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-12-10 13:53 -0800
Re: Postitioning a control in a form "Ron Paii" <None@none.com> - 2014-12-10 16:33 -0600
Re: Postitioning a control in a form Ulrich Möller <knobbi38@arcor.de> - 2014-12-11 00:56 +0100
Re: Postitioning a control in a form "Phil" <phil@stantonfamily.co.uk> - 2014-12-11 08:57 +0000
csiph-web