Lebans Tooltip Control : Listbox font size

G

Guy

I am using the Lebans '97 tooltip control for adding some richer
functionality to a form on my Access database.
However, I appear to have a problem. My endusers tend not have particuarly
good eyesight and so I have increased the default size of the list items in
the listbox for which I want the Tooltips to appear. This causes the tooltip
code lose its relative row position and so its displays tooltip text for
another row. The longer the list - the larger the error in the no. rows the
text is offset.... apart from reverting to the default font size - is there
a fix for this?

Thank you in advance.

Regards
G
 
S

Stephen Lebans

Hi Guy,
it does not matter what Font size you use. Have you looked at my Comments in
the source code for this issue?

' Height of Text
' This is not a perfect solution.
' The first row is not as tall as the rest
' of the rows so we will fudge a bit.
' Also you should have the Listbox's last row
' be completely visible. Finally the ListBox must not have
' any empty rows at the bottom of the Control.
m_HeightSingleRow = pt.cy - 1
' Convert pixels to Twips
m_HeightSingleRow = m_HeightSingleRow * (TWIPSPERINCH /
m_ToolTip.ScreenYdpi)
' Now divide the control's height by the height of one row of Text
m_TotalDisplayedRows = m_ListBox.Height \ m_HeightSingleRow

Let me know how you make out.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guy

Stephen
Thank you for your prompt response.

I have found this code and inspected var. values on step through.

m_TotalDisplayedRows = 19 - yet the actual list box in question only has 10
displayed rows (excl. column headers).

Note : I have reset the listbox font size to 8 (default) and the tooltip
text is correct for ALL rows - so the font size does appear to be the
problem -for me at least.....

Also, I note the tooltip graphic displays for the column header and all
space below any valid rows in the listbox....? Can this be prevented?

Thanks
 
G

Guest

An alternative might be to use a pop up form and open it using the mouse
over event and then a timer to close it.
 
S

Stephen Lebans

Are you working with Access 2003? Prior to 2003(I think), the Tooltips class
works correctly for any size font in the ListBox. I cheated a bit to save
time when calculating the font height for a row in the ListBox. It's my
opnly solution that uses this method and now it is biting me in the ass.
Access 2003, when instantiating the ListBox in the form's Load event, does
not bother to select the font into the ListBox's Device Context. Instead it
creates the DC with the default 8 point font. Honestly, I cannot see me
finding time to correct this for a couple of weeks yet.

To work around this, I need to create a DC myself and select the font into
it that matches the control's Font prop's settings.

As it states in the commented source code, you cannot have any partial or
empty rows at the bottom of your ListBox. You have to size your control to
display full rows.

Finally, you can turn off the column header Tooltip by NOT enabling Column
Headers property in your ListBox control. Just place a couple of Lable
controls as pseudo Column Headers(no support for horizontal scrolling
though.)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guy

Unfortunately, I am working with Access 97.....

I note your comments on the listbox full/partial rows but your coments were
not clear to me how to do this.
Are you suggesting that the listbox has to be 'dynamically sized' at runtime
to accmodate only the number
of rows that will be displayed? Doesn't this defies most GUI design
practice?

Guy
 
S

Stephen Lebans

Guy what I mean is that in form Design view, resize the ListBox control so
that the last row of your ListBox displays completely. For example, your
ListBox is sized to display 10 rows of data at a time out of a row source of
100 rows. Make sure the control is sized to display 10 complete rows - not
9.5 or 10.5.


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top