Rowtag in popup menu

After taking a frustration break I’m starting over again. I never solved my original problem. In Debugging - Why does the iRowID keep returning zero instead of the Rowtag Number. When I select an item in the Popup Menu. This Method is in a Module that is Global to everything in my project.

I was told in my last post that the code should work. My code example had an error with Page Panel instead of the Container Control but the Container Control is on a Page Panel. Is this a problem with Scope to the Container Control? If so should the method be relocated to the Container Control.

I saw examples in other similar posts about using extends. "Sub SetId(extends pm as PopupMenu, id as integer) ". I don’t have a clue how to rewrite my method to extends and where to put it. Can anyone help me so I can get this to work? Thank You

[code]Dim sql As String
Dim rs As RecordSet
Dim iRowID As Integer

iRowID = WinMain.ContrControl.PopupMenu.RowTag(WinMain.ContrControl.PopupMenu.ListIndex)

For i As Integer = 0 To WinMain.ContrControl.PopupMenu.ListCount -1
If WinMain.ContrControl.PopupMenu.RowTag(i) = iRowID Then
sql = "SELECT * FROM MyTable WHERE ID = "+ str( iRowID )
Exit For i
End If
Next

rs = db.SQLSelect(sql)[/code]

Your PopupMenu is really called PopupMenu, the class name? Not PopupMenu1 or something similar? (and I suspect you do the same for the ContainerControl)

And the ContainerControl is on a PagePanel? Why is there no mention of it in the access code?

Something like

MainWindow.PagePanel1(2).ContainerControl1.PopupMenu1.RowTag(3)

ContainerControls should also be pretty much self-contained, so you would use “bridging” methods to talk to the inside, like

ContainerControl1.SetPopupCompany( “Xojo” )

Hi Markus

No I renamed the controls to summarize and simplify things here. Here is the original below.

iRowID = frmGAmain.ctrGtr6FrtBrd1.ppmFngTyp.RowTag(frmGAmain.ctrGtr6FrtBrd1.ppmFngTyp.ListIndex)

Page Panel has 4 Panel each with a container control 0-3. pgpInstDisp(0), pgpInstDisp(1)… Updated below for 0

iRowID=frmGAmain.pgpInstDisp(0).ctrGtr6FrtBrd1.ppmFngTyp.RowTag(frmGAmain.pgpInstDisp(0).ctrGtr6FrtBrd1.ppmFngTyp.ListIndex)

Xojo Error Check is flagging too many argument highlighting the Page Panel number

It doesn’t care with missing Page Panel in the dot notation and debug compiles. All my other methods besides my Rowtag issue works fine with this.

frmGAmain.ctrGtr6FrtBrd1.ppmFngTyp.ListIndex

I understand the logic of completing the page panel dot notation (which fails) Sorry. I know nothing about bridging methods. If it is a new OOP coding style I need to learn. Can you please refer me to some XDev reading material or in the new Xojo Docs on this topic.

Thank You for doing the best to help
Sorry for my frustrations
Jeff

Because pgpInstDisp(0) is an integer value. There is nothing to complete.

Hi Mark

I remember at one of the Xojo or maybe the last Real Studio intro Xojo Conference Bob Kenny mentioned about a couple of issues with the Page Panel way back there. So far I’ve been pretty lucky up to this one issue.

I’ve been using 2015r3.1 for my current Windows build and this new project. Anything newer than that my code starts breaking.

I’m an old VB6 dog that has to learn some new Xojo OOP tricks.

Somehow after I take a long break. I stumble across some work around that solves the problem

Thanks so much Mark for all your extra help, effort and patients

If you drag a ContainerControl cc onto panel 0 it becomes cc1.

If you drag a ContainerControl cc onto panel 1 it becomes cc2.

So each ContainerControl is distinguishable in your code. So leave both the (0) and try

iRowID=frmGAmain.pgpInstDisp.ctrGtr6FrtBrd1.ppmFngTyp.RowTag(frmGAmain.pgpInstDisp.ctrGtr6FrtBrd1.ppmFngTyp.ListIndex)

Btw help arrives faster if you supply a simple prpject for people to look at …

+1.
Sometimes it is very hard to understand without a project.

BTW: Jeffrey, did you try your PopupMenu directly on the window (and not in a control that resides into another control, etc.) ?

You don’t need any reference to the PagePanel at all. Have a look at this example:

https://www.dropbox.com/s/qzk3s42rxvax3j4/PagePanelTest.zip?dl=0

So your code should be

iRowID=frmGAmain.ctrGtr6FrtBrd1.ppmFngTyp.RowTag(frmGAmain.ctrGtr6FrtBrd1.ppmFngTyp.ListIndex)

That confirms with what I have found - Thanks Markus. Emile also has a good point to take the popup menu off the container control and page panel to test to see if it works. If it does relay out the controls. I will try that.