gapi Active Member Licensed User Longtime User Mar 16, 2012 #1 Hi all, I want show/hide a panel created from designer on MENU click event. Here the code: Code: Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event If KeyCode = KeyCodes.KEYCODE_MENU Then Activity.LoadLayout("layoutShowOneCliente") Panel1.visible = True Return True End If Return False End Sub how can in some Sub hide that panel1 ? tnx
Hi all, I want show/hide a panel created from designer on MENU click event. Here the code: Code: Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event If KeyCode = KeyCodes.KEYCODE_MENU Then Activity.LoadLayout("layoutShowOneCliente") Panel1.visible = True Return True End If Return False End Sub how can in some Sub hide that panel1 ? tnx
NJDude Expert Licensed User Longtime User Mar 16, 2012 #2 Take a look at the attached sample project. Attachments Sample.zip Sample.zip 6.6 KB · Views: 468 Upvote 0
gapi Active Member Licensed User Longtime User Mar 16, 2012 #3 Keycode_menu many tnx NJDude for you sample, perfect, a question: Can I make a conditional in key_press sub ? Code: If KeyCode = KeyCodes.KEYCODE_MENU Then Activity.LoadLayout("layoutShowOneCliente") If Panel1.visible = false Panel1.visible = True Then Panel1.visible = False End If Return True End If Upvote 0
Keycode_menu many tnx NJDude for you sample, perfect, a question: Can I make a conditional in key_press sub ? Code: If KeyCode = KeyCodes.KEYCODE_MENU Then Activity.LoadLayout("layoutShowOneCliente") If Panel1.visible = false Panel1.visible = True Then Panel1.visible = False End If Return True End If
K kickaha Well-Known Member Licensed User Longtime User Mar 16, 2012 #4 Your code should be Code: If KeyCode = KeyCodes.KEYCODE_MENU Then Activity.LoadLayout("layoutShowOneCliente") If Panel1.visible = false Then Panel1.visible = True Else Panel1.visible = False End If Return True End If Although this is neater Code: If KeyCode = KeyCodes.KEYCODE_MENU Then Activity.LoadLayout("layoutShowOneCliente") Panel1.visible = Not (Panel1.visible) Return True End If Upvote 0
Your code should be Code: If KeyCode = KeyCodes.KEYCODE_MENU Then Activity.LoadLayout("layoutShowOneCliente") If Panel1.visible = false Then Panel1.visible = True Else Panel1.visible = False End If Return True End If Although this is neater Code: If KeyCode = KeyCodes.KEYCODE_MENU Then Activity.LoadLayout("layoutShowOneCliente") Panel1.visible = Not (Panel1.visible) Return True End If