How to open a popup on click of button placed in menu page in master detail page in xamarin forms? - popup

I am working on xamarin.forms. I am using Master detail page. In menupage of MasterDetailPage I have some menu items that are listed. At the bottom of the Menu list I placed a button on menu page. Now I need to open a popup on click of that button. I am trying with PopupLayout but not able to get any success.
Please tell me how I can open a custom popup box at the click of the button that is placed in menu page?
Regards,
Anand Dubey

Without going into separate, native projects for all platforms you are targeting (such as Android, iOS, UWP...), you cannot pop out custom UI content over existing pages in Xamarin.Forms out of the box. You would need to bring in additional references or get creative with the AbsoluteLayout control.
Here are a few options you have:
Simple popup with message and or option selection
If all you need is a simple popup message or a list of buttons, you should look into the native DisplayAlert and DisplayActionSheet methods. They are built into Xamarin.Forms and work really well for these simple cases.
More complex popup dialogs
For anything more complex than that, there is the excellent UserDialogs project: ACR UserDialogs github page
It will give you support for various loading dialogs, date, time pickers, action sheet, success/info/error toasts and more.
Fully custom UI markup with AbsoluteLayout
There is a technique where by you prepare the underlying page with a root absoltue layout, which enables you to dynamically add new UI on top of all other controls on your page. This is fiddly and can ruin your performance if you are not careful. This is also the approach that the PopupLayout control that you mentioned uses. If done properly, this can be a good solution, but I don't recommend it as it involves additional complexity on each page that hosts the popup content.
Fully custom UI popup on native projects
Your most flexible option, as always, is to fall back to the native projects. This would involve coding up the popup logic on each separate platform that you are targeting, then using DependencyService (or one of the other techniques) to call into it from the shared project. For this you should look at samples and tutorials for popups on separate native platforms as it gets pretty broad and goes way outside the topic of this question.

Related

How can i make the buttons on my sideabar switch tabs?

I have a UI with 4 buttons on a sidebar I made and I have no clue how I can set it so when you press it, it shows a different screen.
I do not need it to open a new window just so it can change between 4-5 "modes"
I am using Bunifu UI
I just took a quick look at the Buniforms reference docs for their WinForms product (I assume you are using their WinForms product) and it look like you want to use the "Transitions" component
https://devtools.bunifu.co.ke/bunifu-ui-winforms-docs/#bunifu-transition
"Bunifu Transition is a special component, that allows us to have transitions in our Windows Forms apps. This is an amazing feature of Bunifu Framework, because it makes our User Interfaces more interactive and improves massively the User Experience. Let’s see how!"
"Bunifu Transition allows us to apply transitions to other controls."

Web-site with two Composite per page. Due to bad design?

I'm creating a web-site using GWT for the first time. The aplication has two Composite class, one of them is a menu and the other one is where I show de info about the specific menu that has been clicked. I'm using MVP, the class History and the interface ChangeValueHandler to switch among different pages.
I have one pair presenter-view for each Composite. The app begins well creating the menu and the section info. When you click in the menu it works fine showing the information and the token browser is changed. The thing is that if you load a page(eg: myapp.com#register) without loading the home page, it doesn't show you the menu. It loads the Composite section info, but not the Composite menu (the Composite menu is load with myapp.com#home).
I think it's because of a bad design of the application, but I don't know how to do that in other way. If the app only had one Composite it wouldn't be a problem, but when there are 2 or more Composite per page I don't know how to manage the whole thing to work properly.
It's difficult to tell what exactly is wrong, because of the lack of code. So I'm guessing. You should design to act on the PlaceChangeEvent instead of the ValueChangeEvent. That means a menu click should fire the place change and then the application will handle this event. That way you unbind the menu actions from your content pages. And think more of each page as a separate entity. Also take a look at the GWT Activity mechanism and how it helps having a main page that is always the same and on that main page a content area that changes depending on the page actually shown.
You should include your menu in each page instead of creating it once in the home page and then keeping it on screen. I assume you create the menu and add it to the DOM via
RootPanel.get().add(myMenuWidget);
If you are using UIBinder it should be pretty straightforward to include the menu in each page, just a matter of adding the corresponding tag in each .ui.xml file of your pages.

Dialog in a Dynamic Content Control

I have a custom control that contains a dynamic content control. The dynamic content displays one of several custom controls. This control is then added to the middle facet (callback1). A Navigator then controls which panel in the dynamic control displays. To this point everything works as it should.
One of the pages that is displayed in the dynamic content has a button that calls a dialog. When the button is clicked it looks like it it is trying to display the dialog but it does not (no errors reported).
If I put the dynamic content control in a simple XPage and load this XPage and have the panel with the control that contains the button to display the dialog open by default it works fine.
So it would appear that the Extension Library Application Layout is blocking the dialog from displaying. I'm at a loss I have the whole application working but not in the ext Library application layout. Wasting an awful lot of time, and not using the ext library app layout is not a good option either.
Found the problem. On the Application Layout custom Control I had some code in the onClientLoad with a try{}catch. If this code failed it 'blocked' the dialog box from displaying properly but the other functions of the window seems to work OK. So I'm not sure what exactly was going wrong in the inner workings of the Application Layout but I moved the code to the BeforePageLoad event and everything now works fine.
This is the code that I moved from onClientLoad to beforePageLoad :
if (!sessionScope.containsKey("ssHelpRepID")){
try{
sessionScope.put("WFSRulesRepID",database.getProfileDocument("frmConfigProfile","").getItemValue("WFSRulesRepID")[0]);
sessionScope.put("WFSRulesRepID_formula",database.getProfileDocument("frmConfigProfile","").getItemValue("WFSRulesRepID_formula")[0]);
sessionScope.put("WFSHelpRepID",database.getProfileDocument("frmConfigProfile","").getItemValue("WFSHelpRepID")[0]);
sessionScope.put("WFSHelpRepID_formula",database.getProfileDocument("frmConfigProfile","").getItemValue("WFSHelpRepID_formula")[0]);
}catch(e){
sessionScope.put("ssError","Error in setting Rep IDs");
}
}
Once I did that the original Application Layout started allowing the dialog to be displayed. Very strange, wish I could bill the time to someone :-)

How to get custom post types to show up in WP's menu selection?

I am using the http://wordpress.org/extend/plugins/reed-write/ plugin.
It's basically nothing more than a UI to create custom post types in Wordpress. However, I am wondering how I can get any new type to show up in menus I create for Wordpress.
In the menu's tab to the left I can add pages, custom links and even standard 'posts'...but no sign of my custom types.
I would love to kno how to get this to show up. It's not a screen options issue it seems so I'm a little stumped.
have a look at this plugin... It does the job for me
wordpress.org/extend/plugins/custom-content-type-manager/

Hyperlink vs Anchor

When to use HyperLink and when to use Anchor?
When using HyperLink how to handle clicks?
com.google.gwt.user.client.ui.Hyperlink.addClickHandler(ClickHandler) is deprecated
com.google.gwt.user.client.ui.Hyperlink.addClickListener(ClickListener) is deprecated as well.
Doc suggests to use Anchor#addClickHandler, but how to use Anchor#addClickHandler when using HyperLink
Does it mean that if I need to handle click I should always use Anchor and never use HyperLink?
Great question, because it is so simple, and yet opens up what might be a whole new area for a lot of GWT programmers. I've up-voted the question just because it can be a great lead-in for people exploring what GWT can do.
Anchor is a widget for storing and displaying a hyperlink -- essentially the <a> tag. Really not much more exciting than that. If you want your page to link to some external site, use anchor.
Links are also used for internal navigation. Let's say I have a GWT app that requires the user to login, so on my first panel I put a login button. When the user clicks it, I would display a new panel with widgets to collect the user's information, code to validate it, and then if validated successfully, reconstruct that first panel the user was on.
Buttons are nice, but this is a browser, and I want my user's experience to be more like a web page, not a desktop app, so I want to use links instead of buttons. Hyperlink does that. The documentation for hyperlink describes it well:
A widget that serves as an "internal" hyperlink. That is, it is a link
to another state of the running application. When clicked, it will
create a new history frame using History.newItem(java.lang.String),
but without reloading the page.
Being a true hyperlink, it is also possible for the user to
"right-click, open link in new window", which will cause the
application to be loaded in a new window at the state specified by the
hyperlink.
That second sentence should help clear it up. The hyperlink is not changing the page in a URL sense (the way anchor does), though the URL will reflect the state of the program by displaying the "token" associated with the hyperlink appended to the base URL after a slash. You define the token. It would be something descriptive like "login" or "help" or "about". But this isn't a new page. There is no additional HTML file you've had to construct to display a help page, for example. It is the state of the current GWT app that is changing. Even if you "open in a new window" you are just running the same app in a particular state.
It looks like a link, but it is really a widget that manipulates the history frame, which in turn allows you to move the state of your GWT application. You don't write a click handler for the hyperlink widget, but a value change handler for the history stack. When you see that the "help" token has been put on the history stack, your handler will execute GWT code to attach to the RootPanel a FlowPanel with embedded HTML text with your help information. This is perceived by the user as a "new page", which is what he expects when he clicks on a hyperlink. The URL will be something.html/help. Now pretend he returns to this URL via the back button, not your hyperlink. No problem. You don't care about the hyperlink click. You only care that, somehow, the history stack changes. Your value change handler fires again, and does the same thing as before to display the help panel. The user still enjoys the experience of navigating through web pages, even though you and I know that there is only one web page and that you are attaching and detaching panels to the RootPanel (or whatever scheme you are using to display your GWT panels).
And this leads to a bonus topic.
This bonus is a bit more complicated, but ironically, it could help better understand hyperlinks. I say more complicated, but really, it helps solidify this notion that a GWT application is made up of a series of states, and that the web page on the screen is just the user's perception of those state changes. And that is Activities and Places. Activities and Places abstracts away this history frame manipulation, handling it in the background once you've set up a mapper with a GWT-provided class designed for this purpose, allowing you to break down your app into a series of activities, and as the user interacts through these activities he is put into different places, and each place has a view. Moreover, the user can move from place to place using browser controls like the address bar, bookmarks, history, and the backward/forward buttons, giving the user a real web-like experience. If you really want to get a grip on the conceptual difference between hyperlinks and anchors, you should try to learn this GWT topic. It can really make you change the way you see your apps, and for the better.
Hyperlink (or InlineHyperlink) is basically no more than a kind of Anchor with a ClickHandler that calls History.newItem and preventDefault() the event (so that the link is not actually followed).
Actually, Hyperlink won't do that if it thinks (and yes, it's only a guess) you right-clicked or middle-clicked (or ctrl-clicked) on the link (depending on the browser), to open the link in a new window or tab.
If you need any other behavior, then don't use Hyperlink and use Anchor instead. And if you want to add some behavior to an Hyperlink, then use an Anchor and mimic what the Hyperlink does. And you can reuse the HyperlinkImpl to have the right-click/ctrl-click handling (see links below).
But actually, if you need something that looks like a link and do something on click, but does not have a "target URL" (i.e. it shouldn't be right-clicked/ctrl-clicked to open in a new window/tab, or it wouldn't mean anything to do so), then do not use either an ANchor or Hyperlink, use a Label of whatever instead, and make it look like a link (but well, maybe you should use a Button and have it look like a button then; Google used to have link-alike buttons –such as the "refresh" link/button in GMail– and changed them to look like buttons when they really aren't links).
See also https://groups.google.com/d/msg/google-web-toolkit/P7vwRztO6bA/wTshqYs6NM0J and https://groups.google.com/d/msg/google-web-toolkit/CzOvgVsOfTo/IBNaG631-2QJ