Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Foreign Languages > German Forum
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Menü mit "Addmenuitem" nur auf Startseite

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-27-2011, 07:18 AM
Basic4ppc Veteran
 
Join Date: Jul 2008
Location: Germany
Posts: 366
Awards Showcase
Beta Tester 
Total Awards: 1
Default Menü mit "Addmenuitem" nur auf Startseite

Hallo, ich habe mehrere Layouts die in Panels geladen werden.
Ich habe Menüs für Einstellungen mit "activity.addmenuitem" zugefügt,
die aber in allen Layouts aufrufbar sind, die Menüs sollen aber nur vom ersten Layout aufrufbar sein, wie kann ich das anstellen ?

Wie ich das sehe, kann die Menüs nur der Activity zufügen, nicht einem Layout ,
richtig ?
__________________
Gruß Paulsche

Samsung Galaxy S2
Reply With Quote
  #2 (permalink)  
Old 07-27-2011, 08:58 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

So wie Du es darstellst geht es leider nicht.
Menüs können nur Activities zugewiesen werden, und können dann auch nicht mehr geändert werden.
Wenn Du verschiedene Menüs brauchst musst Du mit mehreren Activities arbeiten.
Ich verwende keine Menüs und arbeite mit Buttons, jedes Panel hat seine eigene Buttons. Der einzige Nachteil ist der nötige Platzbedarf. Hat für mich aber mehr Vorteile als Nachteile. Ein Beipiel dafür findest Du hier SQLiteDB.

Beste Grüsse.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #3 (permalink)  
Old 07-27-2011, 09:04 AM
Junior Member
 
Join Date: May 2011
Posts: 17
Default

Hi,
ich hab mal gestöbert und den Befehl Activity.CloseMenu gefunden, aber so richtig aussagekräftig ist die Beschreibung dafür nicht. Wenn es das macht, was ich vermute (zum Testen bin ich noch nicht gekommen!) dann könnte man ja bei Aufruf des jeweiligen Panels auch neue Menüs erzeugen ... oder mach' ich da einen Denkfehler!?!?
LG von Peter
Reply With Quote
  #4 (permalink)  
Old 07-27-2011, 09:41 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hallo Peter,

Mit Activity.OpenMenu kann man im Code das Menü anzeigen und mit Activity.CloseMenu wieder zu machen.

Activity.CloseMenu löscht nicht die Menüeinträge.

Best Grüsse.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #5 (permalink)  
Old 07-27-2011, 09:49 AM
Basic4ppc Veteran
 
Join Date: Jul 2008
Location: Germany
Posts: 366
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Ah ok , danke .

Dann muss ich umdenken, entweder das Systemmenü nicht benutzen
oder einen Merker setzen und im jeweiligen Menüpunkt abfragen ob ich auf der Startseite bin, und dann evtl. abbrechen, muss ich testen.

evtl. so:

Code:
Sub MNU_Einstellungen_click                                                            ' Einstellungen
    If     pnl00Startseite.Visible        = True Then                                                ' Startseite ausblenden
        Msgbox("OK, Men� Einstellungen","")
    
Else
        
Msgbox("Men� hier nicht erlaubt","")
    
End If
End Sub
Unschön ist halt dass das Menü zuerst trotzdem aufgeht und dann beim klicken erst "nicht erlaubt" kommt, aber man kann nicht alles haben
__________________
Gruß Paulsche

Samsung Galaxy S2

Last edited by Paulsche : 07-27-2011 at 10:00 AM.
Reply With Quote
  #6 (permalink)  
Old 07-27-2011, 10:17 AM
Filippo's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Schwäb. Gmünd, Germany
Posts: 977
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hallo Paulsche,

also ich persönlich würde dazu mehrere Activities und Layouts verwenden.
Vorteil, du kannst verschiedene Menü einbauen und dein Code ist viel übersichtlicher.

Ciao,
Filippo
__________________
PPC: MDA Pro, 2GB SD
Device: HTC Desire , Android 2.2
______________________
Reply With Quote
  #7 (permalink)  
Old 07-27-2011, 10:53 AM
Basic4ppc Veteran
 
Join Date: Jul 2008
Location: Germany
Posts: 366
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Filippo,

booaa, da sagst Du was, hab mein Programm fast fertig, ne lass mal, jetzt bau ich nix mehr groß um wegen dem Menü, trotzdem danke für den Hinweis
.
__________________
Gruß Paulsche

Samsung Galaxy S2
Reply With Quote
  #8 (permalink)  
Old 07-27-2011, 11:02 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Da Du nur ein Menü hast das Du je nach dem sichtbaren Panel entewder anzeigen willst oder nicht kannst Du es folgendermassen abfangen.
Code:
<font size="2"><font face="Courier New"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">Sub </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">Activity_KeyPress (KeyCode </font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">As </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#008b8b"><font face="Courier New"><font size="2"><font color="#008b8b"><font face="Courier New"><font size="2"><font color="#008b8b">Int</font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font face="Courier New"><font size="2">) </font></font></font></font><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff"><font face="Courier New"><font size="2"><font color="#0000ff">As </font></font></font></font></font></font></font></font></font><font face="Courier New"><font size="2"><font color="#008b8b"><font face="Courier New"><font size="2"><font color="#008b8b"><font face="Courier New"><font size="2"><font color="#008b8b">Boolean</font></font></font></font></font></font></font></font></font>
<font face=
"Courier New"><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff">  If</font></font></font></font></font></font><font size="2"><font size="2"> KeyCode = </font></font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff">KeyCodes</font></font></font></font></font></font><font size="2"><font size="2">.KEYCODE_MENU </font></font></font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">Then</font></font></font>
</font></font></font></font><font face=
"Courier New"><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff">    If</font></font></font></font></font></font><font size="2"><font size="2"> pnl00Startseite.Visible = </font></font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff">True </font></font></font></font></font></font></font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">Then</font></font></font>
</font></font></font></font><font size=
"2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">      Return </font></font></font></font></font></font></font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">False</font></font></font>
</font></font></font></font><font size=
"2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">    Else</font></font></font>
</font></font></font></font><font size=
"2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">      Return </font></font></font></font></font></font></font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">True</font></font></font>
</font></font></font></font><font size=
"2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">    End </font></font></font></font></font></font></font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">If</font></font></font>
</font></font></font></font><font size=
"2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">  End </font></font></font></font></font></font></font><font size="2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">If</font></font></font>
</font></font></font></font><font size=
"2"><font color="#0000ff"><font size="2"><font color="#0000ff"><font size="2"><font face="Courier New"><font color="#0000ff">End Sub</font></font></font></font></font></font></font>
Beste Grüsse.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #9 (permalink)  
Old 07-27-2011, 12:03 PM
Basic4ppc Veteran
 
Join Date: Jul 2008
Location: Schwäbisch Gmünd
Posts: 353
Arrow ... bei mir funzt gar nix!

@ Alle,
... alles schön und gut!
Ich mache es grundsätzlich auch wie Klaus und arbeite mit Buttons.

Ich habe jetzt aber mal interessehalber damit herumexperimentiert (um Paulsche eventuell helfen zu können) und dabei erstaunt festgestellt, dass bei mir das Menü überhaupt nicht funktioniert!

So müsste es doch klappen (abgespeckt dargestellt), oder?
Code:
Sub Activity_Create(FirstTime As Boolean)
Activity.AddMenuItem(
"Programm beenden""ProgrammBeenden")
End Sub

Sub ProgrammBeenden
ToastMessageShow("Programm beenden"False)
Activity.Finish
End Sub
Alles was dabei passiert, ist das das Menü eingeblendet wird, wenn ich aber in das Menü auf "Programm beenden" klicke, passiert nichts!

Es wird weder die Message angezeigt, noch wird die App beendet.

Woran kann das liegen?
__________________
JOTHA | Greetz from the Schwabenländle.
Pocket-PC: HTC HD2 (Dual-Boot WindowsMobile 6.51 + Android 2.2 Froyo)
Reply With Quote
  #10 (permalink)  
Old 07-27-2011, 12:49 PM
Junior Member
 
Join Date: May 2011
Posts: 17
Default

Hi Jotha,
Quote:
Originally Posted by JOTHA View Post
@ Alle,
... alles schön und gut!
Ich mache es grundsätzlich auch wie Klaus und arbeite mit Buttons.

Ich habe jetzt aber mal interessehalber damit herumexperimentiert (um Paulsche eventuell helfen zu können) und dabei erstaunt festgestellt, dass bei mir das Menü überhaupt nicht funktioniert!

So müsste es doch klappen (abgespeckt dargestellt), oder?
Code:
Sub Activity_Create(FirstTime As Boolean)
Activity.AddMenuItem(
"Programm beenden""ProgrammBeenden")
End Sub

Sub ProgrammBeenden
ToastMessageShow("Programm beenden"False)
Activity.Finish
End Sub
Alles was dabei passiert, ist das das Menü eingeblendet wird, wenn ich aber in das Menü auf "Programm beenden" klicke, passiert nichts!

Es wird weder die Message angezeigt, noch wird die App beendet.

Woran kann das liegen?
die Sub ProgrammBeenden muss ProgrammBeenden_Click heissen ...
LG von Peter
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
What exactly are "Core" and "Type"? nfordbscndrd Basic4android Updates and Questions 1 05-29-2011 04:38 PM
Catching the "Shift", "right" & "left" keys linum Questions (Windows Mobile) 3 08-21-2009 01:22 PM
calling the device's "Programs" or "settings" screens karmba_a Questions (Windows Mobile) 3 03-15-2009 05:41 PM
"AddEvent" and "buttonUp/buttonDown" Byak@ Questions (Windows Mobile) 12 09-10-2008 03:04 PM
calling the device's "Programs" or "settings" screens HarleyM Questions (Windows Mobile) 0 12-05-2007 02:59 AM


All times are GMT. The time now is 06:22 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0