PopUp-menu Script help please
Wednesday, October 11, 2006 by c242 | Discussion: DesktopX
Sub CreateSectionMenu()
Dim MenuNum
Set mainmenu = nothing
Set mainmenu = DesktopX.CreatePopupMenu '-- Create Main Menu
MenuNum = 1
strQuery = "SELECT * FROM ShopCategories1"
Set RS2 = CreateObject("ADODB.Recordset")
RS2.Open strQuery, Connection, 3, 3
RS2.MoveFirst
While Not RS2.EOF
mainmenu.AppendMenu 0, MenuNum, RS2("ShopCategoryA_en")
msgbox MenuNum & " - " & RS2("ShopCategoryA_en")
MenuNum = MenuNum + 1
RS2.MoveNext
Wend
RS2.Close
Set RS2 = Nothing
Call ExecuteSectionMenu(result,snum)
End Sub
The msgbox code is for testing purposes only and shows the wright values. Nevertheless the menu doesn't show up. Did I oversee anything ? This is just a copy of other menus that work flawlessly. Only this one is giving me a headache...
Reply #2 Wednesday, October 11, 2006 2:09 PM
Reply #3 Thursday, October 12, 2006 1:10 AM
Reply #4 Friday, October 20, 2006 11:22 PM
Dim xarray(),n
Sub CreateSectionMenu()
n = 0
On Error Resume Next
strQuery = "SELECT * FROM ShopCategories1"
Set RS2 = CreateObject("ADODB.Recordset")
RS2.Open strQuery, Connection, 3, 3
RS2.MoveFirst
While Not RS2.EOF
Redim Preserve xarray(n)
xarray(n) = RS2("ShopCategoryA_en")
n = n + 1
RS2.MoveNext
Wend
RS2.Close
Set RS2 = nothing
Set mainmenu = nothing
Set mainmenu = DesktopX.CreatePopupMenu '-- Create Main Menu
x = 1
For i = 0 To UBound(xaray)
mainmenu.AppendMenu 0, x, xaray(i)
msgbox x & " - " & xaray(i)
Next
result = mainmenu.TrackPopupMenu(0, System.CursorX, System.CursorY)
Call ExecuteSectionMenu(result,1)
End Sub
Sub ExecuteSectionMenu(n,x)
For i = 0 To UBound(xarray)
Select Case n
Case x "your object" = xarray(i)
End Select
x = x + 1
Next
Erase xarray
Set mainmenu = nothing
End Sub
Hope this will help you...
Long Live DX PRO!
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Wednesday, October 11, 2006 6:01 AM
I forgot to add :
result = mainmenu.TrackPopupMenu(0, System.CursorX, System.CursorY)