Le 29 sept. 06 à 14:22 Soir, Bart Pietercil a écrit:

Thx Arnaud,
In the PagePanel, put this in the Change event:

  if me.Value=2 then
    Beep
    MsgBox "You can't use that tab."
    me.Value=MyLastIndex
  Else
    MyLastIndex=me.Value
  end if

This is somehow what I tried but then I got this problem (mail it to the list under "Tabpanel Stackoverflow exception ")

Ian Jones already explained what was wrong with the code.

Your code is slightly different than the one I posted.
See yourself, there is no method calling itself infinitely:

I rewrite the code I posted without the extra informations:

if me.value=2 then
        me.value=MyLastIndex
else
        MyLastIndex=me.value
end if

So:
you select the 3rd tab (which is the value of 2).

The "me.value=MyLastIndex" line is executed. Indeed, this calls "another instance" of the Change event, which executes the second block (MyLastIndex=me.value). Then, the second instance leaves the sub, and, then, the first instance also leaves. You can't have an infinite call unless MyLastIndex becomes 2, which is not possible here.

Indeed, it would be more elegant to disable the tab, but it's not possible.

Another way, if you are using RB 2005 or 2006, would be to remove completely the tab. As I don't use RB 2005, I can't predict if embedded controls are also removed/hidden or if they are going to another tab, etc.


The LR states that the embedded controls will be removed at the same time. Rebuilding the page with code (rebuilding all controls) was too much off a hassle so I choose the method mentioned above.

Yes. Also, you could move all the controls to the window (with a loop: if self.control(i).tabpanelIndex=2 then) and make them invisibles. You make them visibles again and place them on the tabpanel if you want them back._______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to