Modeless dialog

Modeless dialog

Anonymous
Not applicable
592 Views
9 Replies
Message 1 of 10

Modeless dialog

Anonymous
Not applicable
I would like to show a user form modeless from VBA. Code seems to work OK
using frmScales.Show vbModeless but the form won't retain focus. The next
line of code executes without waiting for the dialog to close. After
looking at the acad customization NG I began wondering if there was an
Inventor control to keep focus.

Thanks,

Tim
0 Likes
593 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable
The modeless form is working exactly as it should. When you show a form
modeless the code continues to execute and does not wait for the form to
close. If you show a form modally, then code execution continues after the
form is closed.



"Tim Strandberg" wrote in message
news:E565232438A0078C4AE959E8AEA52E2B@in.WebX.maYIadrTaRb...
> I would like to show a user form modeless from VBA. Code seems to work OK
> using frmScales.Show vbModeless but the form won't retain focus. The next
> line of code executes without waiting for the dialog to close. After
> looking at the acad customization NG I began wondering if there was an
> Inventor control to keep focus.
>
> Thanks,
>
> Tim
>
>
0 Likes
Message 3 of 10

Anonymous
Not applicable
Any suggestions then if I want to display modelessly AND wait for form to
close before continuing?


"ML" wrote in message
news:180997DFA541A16006D236E09044C3ED@in.WebX.maYIadrTaRb...
> The modeless form is working exactly as it should. When you show a form
> modeless the code continues to execute and does not wait for the form to
> close. If you show a form modally, then code execution continues after the
> form is closed.
>
>
>
> "Tim Strandberg" wrote in message
> news:E565232438A0078C4AE959E8AEA52E2B@in.WebX.maYIadrTaRb...
> > I would like to show a user form modeless from VBA. Code seems to work
OK
> > using frmScales.Show vbModeless but the form won't retain focus. The
next
> > line of code executes without waiting for the dialog to close. After
> > looking at the acad customization NG I began wondering if there was an
> > Inventor control to keep focus.
> >
> > Thanks,
> >
> > Tim
> >
> >
>
>
0 Likes
Message 4 of 10

Anonymous
Not applicable
Why modeless if you want to wait?

"Tim Strandberg" wrote in message
news:632662A7EDE12A9C8C6E11631CD3D102@in.WebX.maYIadrTaRb...
> Any suggestions then if I want to display modelessly AND wait for form to
> close before continuing?
>
>
> "ML" wrote in message
> news:180997DFA541A16006D236E09044C3ED@in.WebX.maYIadrTaRb...
> > The modeless form is working exactly as it should. When you show a form
> > modeless the code continues to execute and does not wait for the form to
> > close. If you show a form modally, then code execution continues after
the
> > form is closed.
> >
> >
> >
> > "Tim Strandberg" wrote in message
> > news:E565232438A0078C4AE959E8AEA52E2B@in.WebX.maYIadrTaRb...
> > > I would like to show a user form modeless from VBA. Code seems to
work
> OK
> > > using frmScales.Show vbModeless but the form won't retain focus. The
> next
> > > line of code executes without waiting for the dialog to close. After
> > > looking at the acad customization NG I began wondering if there was an
> > > Inventor control to keep focus.
> > >
> > > Thanks,
> > >
> > > Tim
> > >
> > >
> >
> >
>
>
0 Likes
Message 5 of 10

Anonymous
Not applicable
I am collecting the various view scales and want the user to choose one.
The overall scale for the drawing is displayed in the title block. I want
the user to be able to view my form with a listbox showing all scales and
zoom in on the titleblock at the same time. I thought if I showed the scale
modeless this would accomplish what I want.???
"Randy Sanders" wrote in message
news:8A5747ACEC5B98BEB613A0832E2B1097@in.WebX.maYIadrTaRb...
> Why modeless if you want to wait?
>
> "Tim Strandberg" wrote in message
> news:632662A7EDE12A9C8C6E11631CD3D102@in.WebX.maYIadrTaRb...
> > Any suggestions then if I want to display modelessly AND wait for form
to
> > close before continuing?
> >
> >
> > "ML" wrote in message
> > news:180997DFA541A16006D236E09044C3ED@in.WebX.maYIadrTaRb...
> > > The modeless form is working exactly as it should. When you show a
form
> > > modeless the code continues to execute and does not wait for the form
to
> > > close. If you show a form modally, then code execution continues after
> the
> > > form is closed.
> > >
> > >
> > >
> > > "Tim Strandberg" wrote in message
> > > news:E565232438A0078C4AE959E8AEA52E2B@in.WebX.maYIadrTaRb...
> > > > I would like to show a user form modeless from VBA. Code seems to
> work
> > OK
> > > > using frmScales.Show vbModeless but the form won't retain focus.
The
> > next
> > > > line of code executes without waiting for the dialog to close.
After
> > > > looking at the acad customization NG I began wondering if there was
an
> > > > Inventor control to keep focus.
> > > >
> > > > Thanks,
> > > >
> > > > Tim
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 6 of 10

Anonymous
Not applicable
It will! Modeless simply means you are able to select and do things in Inventor and
still have the dialog showing.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program



"Tim Strandberg" wrote in message
news:6BFE48FC0C937295EC3765963B57569F@in.WebX.maYIadrTaRb...
> I am collecting the various view scales and want the user to choose one.
> The overall scale for the drawing is displayed in the title block. I want
> the user to be able to view my form with a listbox showing all scales and
> zoom in on the titleblock at the same time. I thought if I showed the scale
> modeless this would accomplish what I want.???
0 Likes
Message 7 of 10

Anonymous
Not applicable
Maybe I'm not explaining myself correctly. I'm programmatically opening the
idw, collecting all the view scales, feeding them to a listbox and showing
the form containing the listbox. The form also has an button on it which
the user clicks after selecting a scale from the list. In psuedo code it
looks like this:

'Form w/listbox
Private Sub CommandButton1_Click()
SavedScale = lstScales.Text
Unload Me
End Sub

'...Snip from end of scale routine...
' Add all the Scales to a String
For i = UBound(SortedScales) To 1 Step -1
frmScales.lstScales.AddItem ConvScale(SortedScales(i))
Next i
frmScales.lstScales.AddItem ConvScale(SortedScales(i))
frmScales.Show
' I need to pause right here waiting for the form to return.
Debug.Print SavedScale

'Add a custom property "Scale" with all the view scales
Dim oPropSet As PropertySet
Set oPropSet =
ThisApplication.ActiveDocument.PropertySets("{F29F85E0-4FF9-1068-AB91-08002B
27B3D9}")
oPropSet.Item("Comments").Value = oPropSet.Item("Comments").Value &
"Sheet" & SheetNumber & "*" & SavedScale & ","
Set oPropSet = Nothing
End Sub

Do I need to set a flag from the form button and go into a loop waiting for
it to change?

Thanks,


"Kent Keller" wrote in message
news:8CE58B48F0EF57EC82C66E272FC485DD@in.WebX.maYIadrTaRb...
> It will! Modeless simply means you are able to select and do things in
Inventor and
> still have the dialog showing.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
>
> "Tim Strandberg" wrote in message
> news:6BFE48FC0C937295EC3765963B57569F@in.WebX.maYIadrTaRb...
> > I am collecting the various view scales and want the user to choose one.
> > The overall scale for the drawing is displayed in the title block. I
want
> > the user to be able to view my form with a listbox showing all scales
and
> > zoom in on the titleblock at the same time. I thought if I showed the
scale
> > modeless this would accomplish what I want.???
>
>
0 Likes
Message 8 of 10

Anonymous
Not applicable
Tim

I am probably still missing it, but shouldn't this part be under the Button
Code? You may have to declare a couple of the things outside of the sub as
Private such as "SheetNumber" and "SavedScale" to get it to work that way
but it should work I think.

'Add a custom property "Scale" with all the view scales
Dim oPropSet As PropertySet
Set oPropSet =
ThisApplication.ActiveDocument.PropertySets("{F29F85E0-4FF9-1068-AB91-08002B
27B3D9}")
oPropSet.Item("Comments").Value = oPropSet.Item("Comments").Value &
"Sheet" & SheetNumber & "*" & SavedScale & ","
Set oPropSet = Nothing

--
Kent Keller
Member of the Autodesk Discussion Forum Moderator Program

http://www.MyMcad.com/KWiK/Mcad.htm

"Tim Strandberg" wrote in message
news:60E6439839CA11FE3A527718550EDB90@in.WebX.maYIadrTaRb...
> Maybe I'm not explaining myself correctly.
0 Likes
Message 9 of 10

Anonymous
Not applicable
Well that just make way to much sense....You know how when you author some
code and you look at it for so long you begin believing that's the only way
it can flow???????

Thanks Kent!!


"Kent Keller" wrote in message
news:F61F73F19D3E3988E47F21433FBCE3AE@in.WebX.maYIadrTaRb...
> Tim
>
> I am probably still missing it, but shouldn't this part be under the
Button
> Code? You may have to declare a couple of the things outside of the sub
as
> Private such as "SheetNumber" and "SavedScale" to get it to work that way
> but it should work I think.
>
> 'Add a custom property "Scale" with all the view scales
> Dim oPropSet As PropertySet
> Set oPropSet =
>
ThisApplication.ActiveDocument.PropertySets("{F29F85E0-4FF9-1068-AB91-08002B
> 27B3D9}")
> oPropSet.Item("Comments").Value = oPropSet.Item("Comments").Value &
> "Sheet" & SheetNumber & "*" & SavedScale & ","
> Set oPropSet = Nothing
>
> --
> Kent Keller
> Member of the Autodesk Discussion Forum Moderator Program
>
> http://www.MyMcad.com/KWiK/Mcad.htm
>
> "Tim Strandberg" wrote in message
> news:60E6439839CA11FE3A527718550EDB90@in.WebX.maYIadrTaRb...
> > Maybe I'm not explaining myself correctly.
>
>
0 Likes
Message 10 of 10

Anonymous
Not applicable
Absolutely know the feeling. I think I have gotten to that point on almost
everything I have tried to write. Glad to hear that was what you needed.

--
Kent Keller
Member of the Autodesk Discussion Forum Moderator Program

http://www.MyMcad.com/KWiK/Mcad.htm

"Tim Strandberg" wrote in message
news:B911FE659B31802AF6DF3C3B2A7EB6B8@in.WebX.maYIadrTaRb...
> Well that just make way to much sense....You know how when you author some
> code and you look at it for so long you begin believing that's the only
way
> it can flow???????
0 Likes