how to open the Navigation drawer on the click of menu Icon? - cosmicmind

i am using navigation controller and Navigation drawer controller on the same UIViewController but i don't know how to open the navigation drawer on the click of the menu button. Someone suggest me please.

Referenced from this sample project NavigationDrawer you can add handlers to a button that use the toggle* methods.
#objc
internal func handleMenuButton() {
navigationDrawerController?.toggleLeftView()
}
#objc
internal func handleMoreButton() {
navigationDrawerController?.toggleRightView()
}
The toggle methods observe the state of the NavigationDrawer and then switch to the opposite state. For example, if it is opened it will close, and if it is closed it will open.
If you want to open or close no matter the state, then you can use the open* and close* methods directly.
navigationDrawerController?.openLeftView()
navigationDrawerController?.closeLeftView()
navigationDrawerController?.openRightView()
navigationDrawerController?.closeRightView()
You can see the entire source code here.
That's it, all the best :)

Related

How to create a pop up in hybris backoffice?

I am trying to create a popup message in the Backoffice PCM. In particular, from within the editor area of a product. From the editor a user can click on the assortment view or compare view buttons on the side toolbar to change screens (redirect).
I want to give the user a popup to inform them that any changes will be lost.
Any ideas on how to accomplish this?
I have tried to create my own widget and wiring my custom widget to the ootb pcmbackoffice-toolbar but have not been successful.
It's possible to display a simple popup via the ZK framework (the framework used by Backoffice). From the backoffice code you can open a popup like this:
import org.zkoss.zul.Messagebox;
public void someMethod() {
// do some actions...
Messagebox.show("Some Messagetext", "Info", Messagebox.OK, Messagebox.INFO);
}

Create a generic popup panel

I have added a Global Button with the following code.
public override void Initialize()
{
if (!String.IsNullOrEmpty(Base.PrimaryView))
{
Type primaryViewItemType = Base.Views[Base.PrimaryView].Cache.GetItemType();
PXAction action = PXNamedAction.AddAction(Base, primaryViewItemType, "SubmitTicket", "Submit Ticket", TestClick);
}
}
public IEnumerable TestClick(PXAdapter adapter)
{
throw new PXException("Button clicked from graph" + Base.GetType().Name);
}
And it renders the button like this in each of the pages.
Now, I would like to display a popup panel, on button's click. I know I can create a popup panel on screen section. But, is there some way that I can have a general popup panel created in one place and can be displayed on each of the pages on the button's click?
Thank you.
As #HB_ACUMATICA mentioned there is no good easy way.
Providing another alternative to his post, you can create a graph and use it as a reusable popup by calling:
throw new PXPopupRedirectException(graph, string.Empty, true)
One thing I ran into was a sizing issue on the popup...
Changing the height/width when calling another graph as an in-page popup using PXPopupRedirectException
If you do copy and paste the PXSmartPanel you can create re-usable business logic by implementing the reusable business logic pattern found in this help as a starting point:
Reusing Business Logic
If I understand correctly you want to share the same PXSmartPanel control in different pages without having to copy/paste it in every screen.
In Acumatica Framework this is achieve by custom container controls like 'PXUploadDialog' which derives functionality from other controls like 'PXSmartPanel'. This is the control that is used when you attach files in all screen.
Unfortunately there seems to be no documentation on how to achieve this.
The closest I found is this SO question which is essentially unanswered:
Create custom User Control for Acumatica
Considering this, you may want to copy/paste the same smart panel in all screen.
To ease copying you can use the 'Edit ASPX' feature, make sure you backup the project before.
Edit ASPX to get to the code:
Copy paste your smart panel in the page and click 'GENERATE CUSTOMIZATION SCRIPT' to package the changes in the project:

Updating toolbar button state MFC

I have a dialog in MFC application, which is having menu-bar. Now I have created a toolbar in that dialog using the same command ID which is in the menu-bar.
I use to update the menu-item's state and makes it enable/disable as per some check in ON_UPDATE_COMMAND_UI, When I clicks on the menu. But for toolbar I didn't gets these calls to update it's state, If it should be enabled/disabled.
Moreover I didn't have any notification when the test fails and I to disable the item.
Is there some alternative for doing this?
Thanks
call to ON_UPDATE_COMMAND_UI is only coming when I click on the toolbar button.
Use MFC in a dialog can be frustrating.
I suggest you disable the toolbar button directly when changing state to the variable that will enable / disable the menu:
void CtestDlg::OnBnClickedButton_DisableSomeControls()
{
command_menu_1 = !command_menu_1;
m_ToolBar.GetToolBarCtrl().EnableButton(ID_COMMAND_TEST, command_menu_1);
}
is not very elegant, but it works!

MonoTouch Dialog add a toolbar at the bottom of the dialog

I am trying to add a Toolbar that is anchored to the bottom of a MonoTouch Dialog.
Here is an example:
So as you scroll, the table's contents scroll but the toolbar at the bottom remains in view always. I know how to do this by using the interface builder, but no clue as to how to do this with Mt.D. Please please tell me it can be done!
To do this, it's probably easiest to use the DialogViewController and its View as a child of another UIViewController.
Just create your public class MyViewController : UIViewController class and then create and size your child views in the override ViewDidLoad method.

Change Edit Box content when Button is clicked in mfc

I have an Edit Box and a Button on a dialog. How can I change the content in the edit box runtime as the button is clicked? I have to read a new record from a file and post it in the Edit Box as the Button is clicked and I am using mfc.
Once you have trapped the button press, in most cases the easiest way to change text in an Edit Control is:
SetDlgItemText(IDC_EDIT_ID, "Desired Text String")
Where IDC_EDIT_ID is the ID of the Edit Control (set in the properties window)
You can set the text of an Edit control (wrapped by the CEdit class in MFC) by calling the SetWindowText method, which it inherits from the CWnd base class.
So then all you need to do is respond to a click event on your button control. You do this by listening for the BN_CLICKED notification from the appropriate button control within your parent window's OnCommand method.
Something like:
BOOL CMyDialog::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (HIWORD(wParam) == BN_CLICKED && LOWORD(lParam) == IDC_MYBUTTON)
{
m_Edit.SetWindowText(TEXT("My string"));
}
return CWnd::OnCommand(wParam, lParam);
}
Obtaining and reading a book on MFC would be very helpful. This is fairly basic stuff, but it's a lot to cover in a single answer if you don't already understand the fundamental concepts.
Using the Class Wizard would make this even easier... Invoke it with the Ctrl+W keys and follow the on-screen instructions. You'll end up with something like:
void CMyDialog::OnMyButton()
{
m_Edit.SetWindowText(TEXT("My string"));
}

Resources