MainMenu manipulation library

berndgoedecke

Active Member
Licensed User
Longtime User
How to toggle the checked property

Hello Agraham,
I've recreated the Menu structure of my SqLite Desktop application with Maimenu.dll. I hoped that it is an easy way to use additional features, like the checked property and have more functionalty.
I have a Main menu called "Abfragen"(querries), that holds some Menufunctions like "Neu"(new),"öffnen"(open),"Ausführen"(run),"löschen"(delete) and the querries that are saved in the database. In german it looks like the attached picture.
Now I want to toggle the checked properties of the menu items that holds the querrynames in it, so that the functions above refer to the choosed querry.
I tried something like this, with no success:
In the Menu Popup event I get the count of menus and save the Items
Sub FEx1Men1_Popup
.
.
.
MenC = FEx1Men1.MenuCount
FEx1Men.SaveMenuItem(FEx1Men1.ControlRef, 2)
.
.
End Sub

If a menu was clicked I select the menu.text.
If it is an enty larger than seven I want to check the selected and uncheck the others.

Case 2
Select FEx1Men1.Text
Case "Neue Abfrage"
Quer.Qer_Start
Case "Abfrage öffnen"
Msgbox("Abfrage öffnen")
Case "Abfrage ausführen"
If EINIT = True AND Conv.EditEx1.Text = "Abfrage" Then
If Conv.TBEdit.Text <> "" Then
SqlStr = Conv.TBEdit.Text
FiNa = AktQer
Conv.EditEx1.Close
If MakeQeryTab(SqlStr, FiNa)= True Then
GetParams(FiNa)
fo.FormGrid_Start
End If
End If
End If
Case "Abfrage speichern"
If EINIT = True Then
cdummy = QIn.Show("Name: ", "Abfrage", "", -1, 30)
AktQer = cdummy
QerText = Conv.TBEdit.Text
MakeQerTab
End If
Case "Abfrage löschen"
QerErase(AktQer)
Case Else
AktQer = FEx1Men1.Text
FEx1Men2.ControlRef = FEx1Men1.ControlRef
For i = 7 To MenC-1 'MenC = MenC = FEx1Men1.MenuCount = 16; 7=begin of querry names
FEx1Men1.ControlRef = FEx1Men1.SavedMenuItem(i)
FEx1Men3.ControlRef = FEx1Men1.ControlRef
FEx1Men3.Checked(False)
Next
FEx1Men2.Checked = True
.
.
.
End Sub

This one try of many but I don't know how to set a not selected Menu Item as the actual Item, to set the property.
Could you help? Or isn't it possible with this DLL?

Best regards

berndgoedecke
 

Attachments

  • SQLMenu.JPG
    22.8 KB · Views: 12

berndgoedecke

Active Member
Licensed User
Longtime User
This is one of the possibilties I've allready tested.
The best solution in my opinion is something like that:
For i = 7 To MenC-1 'MenC = MenC = FEx1Men1.MenuCount = 16
FEx1Men3.ControlRef = FEx1Men3.GetMenuItem(i)
FEx1Men3.Checked = False
Next
FEx1Men2.Checked = True
But it throws th attached error although FEx1Men3 is declared.
Do you have another idea?
 

Attachments

  • MenuErr.JPG
    19.6 KB · Views: 4

berndgoedecke

Active Member
Licensed User
Longtime User
I've got it

Hello Agraham,
I've got the solution. In German we say: I must have had a board in front of the head.(Ich muß ein Brett vor dem Kopf gehabt haben.) because it is pretty easy.
AktQer = FEx1Men3.Text
FEx1Men3.ControlRef = FEx1Men.GetMenuItem(2)
MenC = FEx1Men1.MenuCount
For i = 7 To MenC-1 'MenC = MenC = FEx1Men1.MenuCount = 16
FEx1MenT.ControlRef = FEx1Men3.GetMenuItem(i)
If FEx1MenT.Text = AktQer Then
FEx1MenT.Checked = True
Else
FEx1MenT.Checked = False
End If
Next
So it computes. Lot of thanks to you.

Best regards
berndgoedecke
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…