question about monodevelop and Gtk#. I want to put the button on top of WebKit.WebView, but cannot figure out the way to do so. WebView renders on top of button... I try to achieve it using Gtk.Fixed as following:
Gtk.ScrolledWindow htmlScroll= new Gtk.ScrolledWindow();
WebKit.WebView htmlView = new WebView ();
Gtk.Fixed myFixed = new Gtk.Fixed();
Gtk.Button btn= new Gtk.Button();
btn.Visible = true;
btn.Label = "scrl test button";
htmlScroll.Add(htmlView);
myFixed.Put (htmlScroll, 20, 0);
myFixed.Put(btn, 0, 0);
The button is parent for webview. In case I click on the webview area which overlaps with button, the button gets clicked (part of the button is visible). But webview is rendered on top of button. Any hint is highly appreciated.
BR, Madis
Related
Summary
I would like to have more control over the Text rendering on a Button in Xamarin.Forms, so I am using a Grid which contains a Label and Button object. This gives me more control over the text, but it has the side effect of the Label being moved behind the Button when the Button is clicked.
Why does this happen? Shouldn't the ordering of UI be determined by the order in which the children are added to the Grid's Children?
Details
I have created the following code to test the problem in isolation:
// The grid can be added directly to a page
var grid = new Grid();
grid.Margin = new Thickness(100, 100);
grid.WidthRequest = 200;
grid.HeightRequest = 200;
var button = new Button();
button.WidthRequest = 80;
button.HorizontalOptions = LayoutOptions.Start;
button.VerticalOptions = LayoutOptions.Fill;
grid.Children.Add(button);
var label = new Label();
label.Text = "This is some text";
label.VerticalOptions = LayoutOptions.Fill;
label.InputTransparent = true;
grid.Children.Add(label);
The button is sized so that it only overlaps part of the text so that it is clear that the button moves in front of the Label.
Before tapping on the button, this is how the layout appears:
After tapping, the button moves in front of the label as shown in the following image:
I could make the Text have a tap gesture, but then the button wouldn't play its native effect when touched, so I'd like to keep that functionality by clicking on the button.
Is there a way to keep the label in front of the button after a click?
Edit
This has been tested on a Motorola Moto G7 running Android 10 and on an emulator running Android version 9.
Note that on the Android hardware the label remains behind the button permanently. On the emulator the label moves behind the button when the button is pushed, but then re-appears on top after the button is released.
I had done a demo and reappeared the problem. The issue will happend because of the fast renderers. Add the code 'Forms.SetFlags("UseLegacyRenderers");' to your MainActivity class before calling Forms.Init. Such as
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Forms.SetFlags("UseLegacyRenderers");
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
Can somebody explain how to use Dialogue box from above library through XML. Without coding the dialog box using java, Can't I just design it from scene builder by dragging and dropping component.
I have already tried it but when I run the program dialog box is not visible.
Would be really helpful if someone can share a working example or even a link
without using this method.
How to create a dialog using JFXDialog of JFoenix in JavaFX
Double height = posCenterAnchor.getHeight();
Double width = posCenterAnchor.getWidth();
StackPane stackPane = new StackPane();
AnchorPane.setTopAnchor(stackPane, 20.0); // adding anchor pane margins
AnchorPane.setLeftAnchor(stackPane, 20.0);
AnchorPane.setRightAnchor(stackPane, 20.0);
AnchorPane.setBottomAnchor(stackPane, 20.0);
posCenterAnchor.getChildren().add(stackPane);
JFXDialogLayout jfxDialogLayout = new JFXDialogLayout();
Parent parent;
try {
parent = FXMLLoader.load(getClass().getResource("/Views/SelectCustomer.fxml"));
jfxDialogLayout.getChildren().add(parent);
JFXDialog jfxDialog = new JFXDialog(stackPane, jfxDialogLayout, JFXDialog.DialogTransition.CENTER, true);
jfxDialog.show();
} catch (Exception e) {
e.printStackTrace();
}
just figured it out..all i had to do is ,just crate the content of the dialog box in a separate layout file and through code by creating a new dialog object then adding that layout to a dialog box...simple...wonder where went wrong..
I use JxBrowser 6.2 on Windows.
I try to add a swing component (a drop-down menu) above the browser view.
Even adding this component in the modal_layer, the component appears under the browser.
I use this code :
JButton btn = new JButton("Hello");
btn.setBackground(Color.RED);
btn.setBounds(0, 0, 500, 300);
frame.getLayeredPane().add(btn, JLayeredPane.MODAL_LAYER, 0);
Please try using the following approach:
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
Browser browser = new Browser();
BrowserView view = new BrowserView(browser);
You can find more details about this approach at https://jxbrowser.support.teamdev.com/support/solutions/articles/9000013078-jmenubar
I am new to JAVAfx, i trying to code a web browser. The problem i am facing is :- i want to place the button present on the Bottom left of the screen to the bottom right.
I am trying this code but it is not working. Somebody please help
Button Developer = new Button();
Developer.setAlignment(Pos.BOTTOM_RIGHT);
here is the screenshot: http://i.stack.imgur.com/4RTpr.png
Thanks
You should be able to set the alignment on the HBox instead of the Button itself.
Button developer = new Button();
HBox hbox = new HBox();
hbox.setAlignment(Pos.BOTTOM_RIGHT);
hbox.getChildren().add(developer);
I want to show text for the tool button icons using setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
I can see the text for actions directly added to Toolbar (Close & Save), but not for an action(Load) that is added to a QMenu in a Toolbutton. I have added this action in Qmenu to work it as a toggle with other actions(recent files).
I tried to set the text for the Toolbutton too using setText() and setWindowIconText(), but it doesn't work. This is how it looks right now.
Below is the code snippet for the same.
actionLoad = new QAction(QIcon(QString("%1/cn_open.png").arg(imageDir)),tr("Load"), this);
actionLoad->setShortcut(tr("Ctrl+L"));
actionLoad->setStatusTip(tr("Load the model"));
connect(actionLoad, SIGNAL(triggered()), this, SLOT(loadModelDlg()));
actionClose = new QAction(QIcon(QString("%1/cn_close.png").arg(imageDir)),tr("Close"), this);
actionClose->setShortcut(tr("Ctrl+X"));
actionClose->setStatusTip(tr("Close the Model"));
connect(actionClose, SIGNAL(triggered()), this, SLOT(closeModel()));
actionSave = new QAction(QIcon(QString("%1/cn_save.png").arg(imageDir)),tr("Save"), this);
actionSave->setShortcut(tr("Ctrl+S"));
actionSave->setStatusTip(tr("Save the Model"));
connect(actionSave, SIGNAL(triggered()), this, SLOT(saveModel()));
m_FileToolBar = addToolBar(tr("File"));
// Show text under the icon in toolbar
m_FileToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
// Add a menu for recent file items
m_FileMenu = new QMenu();
m_FileMenu->addAction(actionLoad); // Add load button as the first item
for (int i = 0; i < MaxRecentFiles; ++i)
m_FileMenu->addAction(recentFileActions[i]);
updateRecentFileActions();
// Create a tool button. Load button and recent files will be added as a drop down menu
m_FileToolButton = new QToolButton();
m_FileToolButton->setText(tr("Load")); // Not working
m_FileToolButton->setWindowIconText(tr("Load")); // Not working
m_FileToolButton->setMenu(m_FileMenu);
m_FileToolButton->setDefaultAction(actionLoad);
// This creates a dropdown arrow to click.
m_FileToolButton->setPopupMode(QToolButton::MenuButtonPopup);
m_FileToolBar->addWidget(m_FileToolButton);
// These actions show text under the icon
m_FileToolBar->addAction(actionClose);
m_FileToolBar->addAction(actionSave);
Any help to resolve this is appreciated.
Why don't you try something like that:
QToolBar bar;
QToolButton button;
button.setPopupMode(QToolButton::MenuButtonPopup);
button.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
QAction loadAction(QIcon(":/img/openfile"),"Load",&button);
button.addAction(&loadAction);
button.setDefaultAction(&loadAction);
QAction loadAction2("Load 2",&button);
button.addAction(&loadAction2);
bar.addWidget(&button);
bar.show();
I didn't use a QMenu as you can see above.