473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Absolute Position of a Control

675 512MB
I want to know the absolute position (Left & Top) of a textbox control on a form. Form may be Continuous or Single, may or may not have a Header, may be FullScreen or not, etc.

I need this to overlay an automatic "Zoom Box" form on top of the textbox with focus when that textbox's ability to display the text being entered exceeds the size of the textbox. I want this form's textbox Left and Top to exactly match the textbox with focus, so it is not distracting to the user when it appears. Entry typing will not be interrupted. Obviously MoveSize method will be used.

OldBirdman
Dec 16 '08 #1
9 15019
FishVal
2,653 Expert 2GB
Hello, OldBirdMan.

Look into Form.CurrentSectionTop and Form.CurrentSectionLeft properties.
This will help to obtain form coordinates of control regardless quantity and size of form sections as well as whether form is single or continuos view.

As for screen coordinates, it most likely you need to use some API like SetWndowPos() and GetWndowRect(). When I will get a time I will code some samples for you.

Regards,
Fish
Dec 17 '08 #2
FishVal
2,653 Expert 2GB
Ok. Here is the sample.
Attached Files
File Type: zip ZoomTextBox.zip (38.1 KB, 942 views)
Dec 17 '08 #3
OldBirdman
675 512MB
Thank you for the sample code. There is a couple of week's study here for my continuing education. I use a limited subset of Access. This is small enough for me to work with, therefore understand. It has features I didn't think of, and I will add some features I believe essential, like having the ESC key functional as CANCEL.

But it doesn't work in Access 2000:
With Me
.WindowLeft
Compile error: Method or data member not found

It does work in Access 2002, but that is the laptop, and I only use the laptop when travelling. It is not a nice keyboard to do much with.

On the laptop, if the form is maximized within the Access2002 window, the position is not correct. The Zoom window appears at the upper-left corner of a completely gray form, which is not maximized and seems to be in a random position. I guess I can't have everything. Thanks again.

OldBirdman
Dec 17 '08 #4
FishVal
2,653 Expert 2GB
Ok.

I will look into it.
Dec 18 '08 #5
FishVal
2,653 Expert 2GB
@OldBirdman
Ok. I've coded it with WinAPI. See attached example.

..
On the laptop, if the form is maximized within the Access2002 window, the position is not correct. The Zoom window appears at the upper-left corner of a completely gray form, which is not maximized and seems to be in a random position ...
Position is determined right it is really not random. But, unfortunately, when frmZoom is being opened it automatically goes into maximized state (gray area you see) and main form for some reason restore its size. The way around is not to use maximized forms but to set their size to application window. There are many examples all around the net how to do it, like this one .

Regards,
Fish
Attached Files
File Type: zip ZoomTextBox 2.zip (43.0 KB, 433 views)
Dec 18 '08 #6
FishVal
2,653 Expert 2GB
Hello, OldBirdMan.

The last version of control coordinates determination - IMHO, a more robust one, and it works in all form views.

The logic is the following:
  • When Access opens a form it creates multiple windows. One window which is of particular interest is a window which is moved and resized to a control which gains focus.
  • WinAPI function GetFocus() (or more comprehensive GetGUIThreadInfo()) could be used to get handler to this window.
  • Screen coordinates of the window could be determined with GetWindowRect() function.
  • Thus obtained coordinates could be transformed to Access MDI window coordinate system with ScreenToClient() function.

Best regards,
Fish.
Attached Files
File Type: zip ZoomTextBox 3.zip (43.8 KB, 825 views)
Dec 24 '08 #7
OldBirdman
675 512MB
Thank you for your continuing ideas on this subject.

It is taking awhile for me to work with this as there is much code that I do not understand. Trying to learn Access from Help alone creates a slow learning curve, but I haven't yet found any source that really addresses programming in Access.

I'm now trying to make this work, and also combine it with some of the logic I found in a small download "FormsInteractions.zip" from this site. Again, this presents new (to me) concepts and doesn't seem to work correctly when I try to expand and modify it for my needs. Probably my understanding of VBA.

OldBirdman
Dec 26 '08 #8
FishVal
2,653 Expert 2GB
Hello, OldBirdMan.

If you've encountered difficulties while implementing concepts from examples attached to this thread and FormInteractions sample db or you want to get explanations on overall logic and/or particular parts of code, then please post you questions.
I will be happy to discuss it.

Regards,
Fish.
Dec 26 '08 #9
OldBirdman
675 512MB
I work with a subset of Access, and a subset of VBA. Many of the non-experts asking questions on this site seem to be at a similar level, using controls from the Access Toolbox, and code with variables defined by "Dim" and altered with "[Let] varname = expression".

I'll add a field to a table, a workspace, so I don't have to create virtual tables, recordsets, or whatever. I add a lot of hidden controls on a form so I can reference data not shown. I posted a simple solution on the thread "creating a form that can select items and print them" started by "buddyr". This uses a field in the table to track the selections. To me, straightforward. This is the way I am using Access, and that is a sample of my coding.

New to me with these 2 small programs are Events and procedures other than Sub or Function, namely Property.

To ask questions about these here is way off-topic, and belong in new threads. So I will thank you for your time, and muddle onward using something new when I finally understand it.

From this thread I have decided that an automatic ZoomBox is fine, but to attempt to align it on any form, any position, is not going to work.

But maybe if I put enough time in it, I can understand Events, and then not have to have my forms opened Dialog, but can use Modal, which does not pause the code after the open statement. I've always tried to open these child forms as Dialog, and somehow pass the values thru OpenArgs or Global variables. Form_Load then initializes the controls on the form. Never thought of initializing from parent form.

I've been trying to open a child form with the same table as the parent, but cannot make it work. The answer to my problem may be in the short program "FormsInteractions", so I'm hopeful.

Any How-To questions I will ask in a new thread.
Dec 27 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Griff Miller | last post by:
Please see http://home.houston.rr.com/gmiller15/css/vertprob.html . In mozilla 1.6/1.7 it looks the way I want it, with a thin separation between the two boxes. In IE6, the two boxes touch, which...
4
by: wls | last post by:
I've got a problem that requires rendering DIVs at different offset locations, and while I've got a solution that works, the absolute positioning is working to the client window, not to the parent...
4
by: mike eli | last post by:
Hi, I have several absolute positioned elements inside an absolute positioned DIV. I would like one of the nested elements to have a dynamic width. I set it's left and right attributes to 5, so...
7
by: Alex | last post by:
Hi Everone, I need some advice on how to setup 4 columns where the outside two are absolute (120px) and the inner two (side by side) are relevent (Fluid) and change with the screen. Here's my...
3
by: Kenneth | last post by:
Hi, In a webform I have a datagrid in a certain position using gridlayout. <asp:DataGrid id="dgrdSkada" style="Z-INDEX: 107; LEFT: 16px; POSITION: absolute; TOP: 200px" runat="server"...
2
by: Rob R. Ainscough | last post by:
I'm slowly (very slowly) working my way thru the bizarre and sadistic world of control positioning in MultiViews (ASP 2.0). I came across this to help me explain (or attempt to anyway) why my web...
0
by: chris | last post by:
I'm using the code below to attempt to find out the absolute pixel position of an element inside an activex web browser control (axWebBrowser). This example uses the 'www.google.co.uk' web page...
3
by: horusprim | last post by:
Is there a CSS absolute positioning rendering bug in FF1.02 and IE 6? I have been experimenting with precision absolute positioning in CSS. The following test content was used in the...
6
by: ThunderMusic | last post by:
Hi, I think the subject says it all... thanks ThunderMusic
1
by: jobs | last post by:
I have a simple login page with roughly a 300px x 300px image behind the asp.net login control. I need the login control to land in the middle of the image. I want both the image and the login...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.