acDialog form won't accept mouse input?

J

Jack Leach

.....

A2K3 on XP Pro, current updates

I've got a form opened acDialog, and for some reason it is not accepting any
mouse or keyboard input. You can move the mouse around, see the buttons
highlight as you move over them, but clicking does nothing. Tabbing does
nothing. You can grab the titlebar and move the form, but the only available
item on a right click is Form Design (which is how I have to close it at this
point).

I've checked all the form properties... nothing seems amiss.

As of yet, I haven't tried importing or remaking this form. I'm hoping it's
something I'm missing. I can step through every line of code from the
hbtnPrint click to the end of all the Open procedures for frmPrintDialog...
there's nothing hung up codewise that I can tell. I've verified that my tab
order doesn't start on a disabled or invisible control for the problem form.
All data-related properties for the problem form and it's controls are
unbound. I'm out of ideas...


What I'm trying to do is set up a global print dialog for my app. So
there's a little more going on behind the scenes than usual. The form is
being opened as acDialog from a standard module. Here's a process rundown...


-User clicks print button from frmCompanies
-hbtnPrint calls public function InitPrint an passes these arguments
-ReportName
-ReportType (list based or record based)
-List of records if a record based report
-Public InitPrint does some calculations and sets a few globals
-Public InitPrint opens frmPrintDialog in acDialog mode

-frmPrintDialog opens and performs these operations
-verifies an openarg was passed
-fills a listbox with a list of available printers
-selects the default printer in the list box
-hides/shows record selector listbox/buttons based on type





The only other thing I'm wondering if is there's some problem with my
prodecure for filling the listbox with the printers and selecting the
default. The listbox is set to Value List, but oddly enough, I don't see a
property for MultiSelect? I thought there was supposed to be one, but I
don't see it. I don't want multiselect here anyway, but this came across as
odd.

Here's the procedure:


Dim lDefaultPrinter As Long 'index of default printer
Dim lCount As Long 'counter for printers (index)
Dim prt As Printer
'=========================

'populate list and retain index of windows default
lCount = 0
For Each prt In Application.Printers
Me.ctlPrinters.AddItem (prt.DeviceName)
If prt.DeviceName = Application.Printer.DeviceName Then
lDefaultPrinter = lCount
End If
lCount = lCount + 1
Next

Set prt = Nothing

'select default
Me.ctlPrinters.Selected(lDefaultPrinter) = True




I'm at a loss.... anyone see anything?

thanks,


--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
D

Dirk Goldgar

Jack Leach said:
....

A2K3 on XP Pro, current updates

I've got a form opened acDialog, and for some reason it is not accepting
any
mouse or keyboard input. You can move the mouse around, see the buttons
highlight as you move over them, but clicking does nothing. Tabbing does
nothing. You can grab the titlebar and move the form, but the only
available
item on a right click is Form Design (which is how I have to close it at
this
point).

I've checked all the form properties... nothing seems amiss.

As of yet, I haven't tried importing or remaking this form. I'm hoping
it's
something I'm missing. I can step through every line of code from the
hbtnPrint click to the end of all the Open procedures for
frmPrintDialog...
there's nothing hung up codewise that I can tell. I've verified that my
tab
order doesn't start on a disabled or invisible control for the problem
form.
All data-related properties for the problem form and it's controls are
unbound. I'm out of ideas...


What I'm trying to do is set up a global print dialog for my app. So
there's a little more going on behind the scenes than usual. The form is
being opened as acDialog from a standard module. Here's a process
rundown...


-User clicks print button from frmCompanies
-hbtnPrint calls public function InitPrint an passes these arguments
-ReportName
-ReportType (list based or record based)
-List of records if a record based report
-Public InitPrint does some calculations and sets a few globals
-Public InitPrint opens frmPrintDialog in acDialog mode

-frmPrintDialog opens and performs these operations
-verifies an openarg was passed
-fills a listbox with a list of available printers
-selects the default printer in the list box
-hides/shows record selector listbox/buttons based on type



The only other thing I'm wondering if is there's some problem with my
prodecure for filling the listbox with the printers and selecting the
default. The listbox is set to Value List, but oddly enough, I don't see
a
property for MultiSelect? I thought there was supposed to be one, but I
don't see it. I don't want multiselect here anyway, but this came across
as
odd.

Here's the procedure:


Dim lDefaultPrinter As Long 'index of default printer
Dim lCount As Long 'counter for printers (index)
Dim prt As Printer
'=========================

'populate list and retain index of windows default
lCount = 0
For Each prt In Application.Printers
Me.ctlPrinters.AddItem (prt.DeviceName)
If prt.DeviceName = Application.Printer.DeviceName Then
lDefaultPrinter = lCount
End If
lCount = lCount + 1
Next

Set prt = Nothing

'select default
Me.ctlPrinters.Selected(lDefaultPrinter) = True


I'm at a loss.... anyone see anything?


"ctlPrinters" is your list box? If it's not multiselect, I wouldn't set its
value using the .Selected property; instead I'd write:

Me.ctlPrinters = Me.cltPrinters.ItemData(lDefaultPrinter)

However, I don't see how that would have anything to do with the
responsiveness of the dialog form.

Would you be interested in sending me a cut-down version of the database,
with this form in it, to look at? If so, try to include only the elements
necessary to demonstrate the problem, and compact it and zip it to less than
1MB in size (preferably much smaller). I'll have a look at it, time
permitting. You can send it to the address derived by removing NO SPAM and
".invalid" from the reply address of this message. If that address isn't
visible to you, you can get my address from my web site, which is listed in
my sig.
 
J

Jack Leach

"ctlPrinters" is your list box? If it's not multiselect, I wouldn't set its
value using the .Selected property; instead I'd write:

Me.ctlPrinters = Me.cltPrinters.ItemData(lDefaultPrinter)

However, I don't see how that would have anything to do with the
responsiveness of the dialog form.


That did it...

Apparently we can't use Selected on a non-multi select list (can you tell I
don't use list boxes all that often??)

Thanks Much!!

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
D

Dirk Goldgar

Jack Leach said:
That did it...

I'm surprised.
Apparently we can't use Selected on a non-multi select list (can you tell
I
don't use list boxes all that often??)

You *can*, at least under normal circumstances. I've tested it, and it does
work, though there are quirks. So I'm really not sure what was going on
there, or why that change fixed it.
 
J

Jack Leach

This is strange... I can't even find the MultiSelect property (this is
usually under properties -> Data tab, correct?).

Access clearly states that this IS in fact a list box... drag/drop from the
toolbox, rather than textbox -> rightclick -> change to...

Not a big deal either way at the moment, just curious why I don't have the
property. Also, I seem to think (though I haven't verified), that with my
old selection method it wasn't an issue before I started opening the form
acDialog.

Curiouser and curiouser...

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
D

Dirk Goldgar

Jack Leach said:
This is strange... I can't even find the MultiSelect property (this is
usually under properties -> Data tab, correct?).

No, it's on the Other tab.
Also, I seem to think (though I haven't verified), that with my
old selection method it wasn't an issue before I started opening the form
acDialog.

That may be a contributing factor, but I did open my test form in dialog
mode. My offer to look at it still stands.
 
J

Jack Leach

In case anyone else is interested, Dirk has been able to take a look and has
been able to reproduce the following bug:

In a listbox, with MultiSelect set to False, a form will behave as mentioned
when the following method is used to select an item from the list

Me.ListBoxName.Selected(<index>) = True

Per Dirk's testing, this behavior only happens if the list box does not have
the focus at the time of making the selection. Therefore, if the focus is
set on the control before attempting to make the selection, it will work. My
method of filling the list box apparently has no bearing on this either, as
Dirk was able to reproduce the effect through a pre-filled list.

Granted, this is an *incorrect* method of selected a list box item on a
single-select style list. The correct way to do so would be

Me.ListBoxName = Me.ListBoxName.ItemData(<index>)
or simply
Me.ListBoxName = Value

My own testing has revealed the acDialog window style has no bearing on
this, the same results are produced on window opened under a normal style.

At this time, neither of us (that I know of) has tested any of this with the
MultiValue style listbox. I would assume, if this were the case, the
selection method would work fine (being that the .Selected property is there
specifically for working with a MultiSelect). Also, note that no testing
(that I know of) was done with a Table/Query type source, but rather only on
a Value List type source.



--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
D

Dirk Goldgar

Jack Leach said:
At this time, neither of us (that I know of) has tested any of this with
the
MultiValue style listbox. I would assume, if this were the case, the
selection method would work fine (being that the .Selected property is
there
specifically for working with a MultiSelect).

I have used the .Selected property to select items in a multiselect list
box. That does work just fine, though of course it has no effect on the
list box's .Value property, since a mutliselect listbox's value is always
Null.
Also, note that no testing
(that I know of) was done with a Table/Query type source, but rather only
on
a Value List type source.

As it happens, I did test it with a Table/Query rowsource, and found no
difference in the behavior.

Thanks for posting this, Jack.
 

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