From: M Wade on
On 4/7/2010 4:10 PM, Jeff Johnson wrote:
> "M Wade"<nowhere(a)columbus.rr.com> wrote in message
> news:%23Uf2ixo1KHA.5328(a)TK2MSFTNGP04.phx.gbl...
>
>> I have a form that contains several frames that are displayed or hidden
>> under certain situations. One specific frame (fraProvider) is giving me
>> problems. The frame is set to False in the properties. When I run
>> the program normally the frame remains visible. If I step through the
>> code the frame becomes invisible. The code is located in a sub and this
>> is all that is in it. I assume it has to do with timing but
>> I use this type of thing numerous time and this is the only time I have
>> had a problem with it. Do I need to do something to slow down the
>> execution and if so what?
>>
>> ' when a provider name is clicked move it to the text box and hide
>> ' the list box
>> txtProvider = lstProvider.List(lstProvider.ListIndex)
>> mProvArrayPos = lstProvider.ItemData(lstProvider.ListIndex)
>>
>> fraProvider.Visible = False
>> Refresh
>>
>> If gMenuChoice = 5 Then ' new Invoice
>> txtBilled(0).SetFocus
>> ElseIf gMenuChoice = 3 Then ' Initial payment
>> ' give focus to the amount field
>> txtInitialPay.SetFocus
>> Else: Stop
>> End If
>
> You need to search the rest of your code for any time you're setting Visible
> = True on that group box. Perhaps that code is getting called immediately
> after setting Visible to False.
>
>
I did that before I asked for assistance. What baffles me is that it
does what it should do if I step through the sub. It does not work if
it executes without stepping.
From: M Wade on
On 4/7/2010 6:39 PM, GS wrote:
> Typically, this approach implements a structured control mechanism to
> determine which frame is made visible as a result of some user action.
> This might be a menu item or a TV node being clicked, for example, and
> the mechanism sets the visible prop to False for ALL frames and then
> makes the user action 'trigger' element's frame visible.
>
> I use this technique a lot and never encounter what you describe here. I
> use a single proc to handle the display and pass it the index of which
> frame to make visible. This precludes that you use a frames array, and
> your trigger control knows which frame it belongs to. This will also
> work even if you are jumping to another frame within a frame because the
> only frame that displays is the one the trigger control passes the index
> for. What guarantees this is that BEFORE any frame is made visible ALL
> FRAMES ARE **ALWAYS** HIDDEN.
>
> The easiest implementation is using a treeview and having the frames
> array 'syncronized' its Key prop. It's better to store the frame index
> in the Key prop and convert to an Integer before passing to (OR before
> using within) the proc that manages the frames display.
>
> (air code)
> Private Sub DisplayFrame(iNdx As Integer)
> For i = Frame1.LBound To Frame1.UBound
> Frame1(i).Visible = False
> Next
> Frame1(iNdx).Visible = True
> End Sub
>
> HTH
> --
> Garry
>
>
I am NOT using a frame array. As I mentioned earlier it work as it
should if I use F8 to stop through the sub. I does NOT work if the
program flow is not stepped.

From: Henning on

"M Wade" <nowhere(a)columbus.rr.com> skrev i meddelandet
news:O0frxbq1KHA.752(a)TK2MSFTNGP04.phx.gbl...
> On 4/7/2010 6:39 PM, GS wrote:
>> Typically, this approach implements a structured control mechanism to
>> determine which frame is made visible as a result of some user action.
>> This might be a menu item or a TV node being clicked, for example, and
>> the mechanism sets the visible prop to False for ALL frames and then
>> makes the user action 'trigger' element's frame visible.
>>
>> I use this technique a lot and never encounter what you describe here. I
>> use a single proc to handle the display and pass it the index of which
>> frame to make visible. This precludes that you use a frames array, and
>> your trigger control knows which frame it belongs to. This will also
>> work even if you are jumping to another frame within a frame because the
>> only frame that displays is the one the trigger control passes the index
>> for. What guarantees this is that BEFORE any frame is made visible ALL
>> FRAMES ARE **ALWAYS** HIDDEN.
>>
>> The easiest implementation is using a treeview and having the frames
>> array 'syncronized' its Key prop. It's better to store the frame index
>> in the Key prop and convert to an Integer before passing to (OR before
>> using within) the proc that manages the frames display.
>>
>> (air code)
>> Private Sub DisplayFrame(iNdx As Integer)
>> For i = Frame1.LBound To Frame1.UBound
>> Frame1(i).Visible = False
>> Next
>> Frame1(iNdx).Visible = True
>> End Sub
>>
>> HTH
>> --
>> Garry
>>
>>
> I am NOT using a frame array. As I mentioned earlier it work as it should
> if I use F8 to stop through the sub. I does NOT work if the program flow
> is not stepped.
>
What happens if you put a DoEvents before setting .Visible = False?

/Henning


From: Nobody on
"M Wade" <nowhere(a)columbus.rr.com> wrote in message
news:%23Uf2ixo1KHA.5328(a)TK2MSFTNGP04.phx.gbl...
> Else: Stop

What "Stop" is doing here?

Also, what is fraProvider.Visible is set to in the IDE?

Are there are any instances in the code that change fraProvider.Visible?



From: Helmut Meukel on
"M Wade" <nowhere(a)columbus.rr.com> schrieb im Newsbeitrag
news:%23Wd5Qaq1KHA.752(a)TK2MSFTNGP04.phx.gbl...
> On 4/7/2010 4:10 PM, Jeff Johnson wrote:
>> "M Wade"<nowhere(a)columbus.rr.com> wrote in message
>> news:%23Uf2ixo1KHA.5328(a)TK2MSFTNGP04.phx.gbl...
>>
>>> I have a form that contains several frames that are displayed or hidden
>>> under certain situations. One specific frame (fraProvider) is giving me
>>> problems. The frame is set to False in the properties. When I run
>>> the program normally the frame remains visible. If I step through the
>>> code the frame becomes invisible. The code is located in a sub and this
>>> is all that is in it. I assume it has to do with timing but
>>> I use this type of thing numerous time and this is the only time I have
>>> had a problem with it. Do I need to do something to slow down the
>>> execution and if so what?
>>>
>>> ' when a provider name is clicked move it to the text box and hide
>>> ' the list box
>>> txtProvider = lstProvider.List(lstProvider.ListIndex)
>>> mProvArrayPos = lstProvider.ItemData(lstProvider.ListIndex)
>>>
>>> fraProvider.Visible = False
>>> Refresh
>>>
>>> If gMenuChoice = 5 Then ' new Invoice
>>> txtBilled(0).SetFocus
>>> ElseIf gMenuChoice = 3 Then ' Initial payment
>>> ' give focus to the amount field
>>> txtInitialPay.SetFocus
>>> Else: Stop
>>> End If
>>
>> You need to search the rest of your code for any time you're setting Visible
>> = True on that group box. Perhaps that code is getting called immediately
>> after setting Visible to False.
>>
>>
> I did that before I asked for assistance. What baffles me is that it does
> what it should do if I step through the sub. It does not work if it executes
> without stepping.


So stepping through the code will make the frame invisible.
Does it stay so if you then press F5?
Did you try it compiled?
How about a DoEvents before or after Refresh.
Is the Refresh only there because you have the problem?

If you already found what caused the problem, would you mind telling us?

Helmut.