Get usual spacing for menu and toolbar in Qooxdoo - qooxdoo

Doing a simple setup with a Qooxdoo menu bar and tool bar I get an unexpected layout.
Running this snippet in the Qooxdoo playground:
const layout = new qx.ui.layout.VBox(5);
const container = new qx.ui.container.Composite(layout);
const menubar = new qx.ui.menubar.MenuBar();
const menu = new qx.ui.menu.Menu();
menubar.add(new qx.ui.menubar.Button('File'), null, menu);
const toolbar = new qx.ui.toolbar.ToolBar();
toolbar.add(new qx.ui.toolbar.Button('test'));
container.add(menubar,{flex:0});
container.add(toolbar,{flex:0});
const windowManager = new qx.ui.window.Manager();
const desktop = new qx.ui.window.Desktop(windowManager);
desktop.setBackgroundColor('#a0f0f0');
container.add(desktop,{flex:1});
this.getRoot().add(container, {edge: 0});
I get this result:
How can I get rid of the white separators and also remove most of the grey padding in the toolbar?
The final result should look like a usual desktop application.

In your VBox layout you set 5px what means spacing between children. Pass 0 to get rid of it. Also setPadding(0,0,0,0) for both toolbar and menubar to reduce "grey" padding. For buttons of toolbar setMargin(0,0,0,0) to get rid of margin of buttons.

Related

Pass document while rendering a React component in outer window

I am trying to handle React components in popup outer windows, I am using FlexLayout, ag-Grid React and SyncFusion React and I managed to handle the outer window with FlexLayout by using const currentDocument = this.selfRef.current.ownerDocument; -check Floating Tabs (Popouts) in FlexLayout- and pass this currentDocument to getDocument() callback in ag-Grid and now I wanted to do the same with SyncFusion, but I found no method/property in SyncFusion to pass the currentDocument to it.
So, is there anyway to pass the outer window document to the SyncFusion component which will be re-rendered after going in outer window and leave the origin document?
Attached a screenshot for the issue when not passing the currentDocument (new outer window) to SyncFusion components I have pressed the Date Picker button in the outer window (on the right), but the DatePicker component rendered in the original window (on the left)!
SyncFusion DatePicker Issue Screenshot
You can align the popup position relate to input element by setting X and Y position in the open event of DateTimePicker popup as mentioned in the below code example.
this.onOpen = (args) => {
args.popup.position = { X: "left", Y: "bottom" };
};
The possible values for popup position are left, right, top and bottom. Try specifying the all possible combination of values to align the popup based on your viewport.
Also, you can set the offsetX and offsetY value in number (Provide the x and y value by imaging x and y axis) to align the DateTimePicker popup relate to the input element. Here, we have provided the offsetX and offsetY value based on the desktop mode. You can customize it based on the view port.
this.onOpen = (args) => {
args.popup.offsetX= 1000;
args.popup.offsetY= 1000;
};
Sample Link: https://stackblitz.com/edit/react-yhgq4y-w2avy2?file=index.js
Provide more details about your query, if the solution suggested above does not help you.
You can customize the DatePicker popup’s in the desired position using the appendTo method in the open event argument. Kindly refer the below code,
render() {
return (
<div className="control-pane">
<div className="control-section">
<div className="datepicker-control-section">
<DatePickerComponent open={this.onOpen.bind(this)} />
</div>
</div>
<div id="target" />
</div>
);
}
onOpen(args) {
args.appendTo = document.body.querySelector("#target");
}
Please find the sample below,
Sample link: https://stackblitz.com/edit/react-eekdsn?file=index.js

Problem with initializing existing canvas with PixiJs

As titled,
Is it possible to initialize canvas with image on it using Pixi so that i can add filter on top of it? Im using gsap 3.2.6 and Pixi 5.2.4.
I have the canvas created like this (using React btw)
useEffect(() => {
let ctx = imgDisplayer.current.getContext('2d');
let img = new Image();
img.onload = function(){
imgDisplayer.current.width = img.width; // To set canvas width to image width
imgDisplayer.current.height = img.height; // To set canvas height to image height
ctx.drawImage(img, 0, 0);
setCanvas(imgDisplayer.current);
}
img.src = source;
}, []);
That setCanvas is to store the loaded canvas into state, so that i can use it to initialize Pixi.
if (canvas){
const app = new Pixi.Application({
width: 1300,
height: 866,
backgroundColor: 0x000000,
autoResize: true,
view: canvas
});
}
Problem is, this throws me the following error
Error: This browser does not support WebGL. Try using the canvas renderer
If only i could fetch an https image (direct image link) then this wouldn't be a problem, and i can load the image using Pixi.Sprite insteaad.. but because of cross origin, i cannot think of way on how to render the image. I can render it just fine on canvas, but not with Pixi.
The error you pasted is saying that your browser does not support WebGL.
Please check WebGL support on those pages: https://get.webgl.org/ , https://webglreport.com/
Can you try to initialize Pixi on some simpler page just to check if it works for you? I mean, just create simple html page (without React etc), try to setup Pixi there and try to draw anything (some red circle etc).

Header grows after rendering inside react native application

I am creating an application using react native/expo, using react-navigation for navigation.
I need a bottom tab navigator, and for every tab i need a stack navigator. I have followed the example on the website and it functionally works fine. (https://reactnavigation.org/docs/en/tab-based-navigation.html)
Everytime i select a different stack from on the tab navigator the new header renders (great)! but it then grows as if its adding padding to compensate for the status bar.
is there any way to solve this?
thankyou.
You can add the following to remove extra statusbar height for all screens in a navigator:
const MyStack = createStackNavigator({
// screens
}, {
defaultNavigationOptions: {
headerStatusBarHeight: 0
}
});
Or you can do it per screen:
static navigationOptions = {
headerStatusBarHeight: 0
}
You can also specify a custom value if you need.

React Draft Wysiwyg apply bold, italic or udenderlina to whole content

I need to apply the Bold, Italic, Underline style to the whole content of editor, without selected text, like the align styles but I couldn't find the way for that. Is the possible to change the action or handler?
Yes, it is possible. You could update your SelectionState at the moment where your applying style.
Here, we selecting all text
const selection = editorState.getSelection().merge({
anchorKey: currentContent.getFirstBlock().getKey(),
anchorOffset: 0,
focusOffset: currentContent.getLastBlock().getText().length,
focusKey: currentContent.getLastBlock().getKey()
});
Then, we applying new selection
const editorStateWithAllSelection = EditorState.acceptSelection(
editorState,
selection
);
const newState = RichUtils.toggleInlineStyle(
editorStateWithAllSelection,
inlineStyle
)
if you want to avoid your text to be selected in the end result, we could apply our old selection
const selectionBefore = editorState.getSelection();
// updating selection, toggling style ...
const editorStateWithSelectionBefore = EditorState.acceptSelection(
newState,
selectionBefore
);
setEditorState(editorStateWithSelectionBefore);
Example on Codeandbox

Textfield text in InteractionDialog only shown when TextField has focus

In an InteractionDialog of mine there is a TextField. I set the TextField style to a UIID defined in CSS. The TextField background is shown but not the text inside it
although
System.err.println("The textfield contains " + nameTf.getText());
prints the expected text and the foreground color is 0 as expected. The text is only shown when I press inside the TextField but as soon as I press outside it disappears as shown below :
No EDT violation appears in the console.
The code used is the following :
// Opens a dialog to input the name
nameButton.addActionListener((evt) -> {
InteractionDialog nameDialog = new InteractionDialog();
nameDialog.setLayout(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER));
// Hint for the user
SpanLabel hintLabel = new SpanLabel("Indiquer un nom");
hintLabel.setTextUIID(hintStyleName);
TextField nameTf = new TextField(
chosenAlarm.name.get() == null ? "Ma destination préférée" : chosenAlarm.name.get()
);
nameTf.setUIID(textFieldStyleName);
System.err.println("The textfield colour is " + nameTf.getUnselectedStyle().getFgColor());
// Validate text button
Button validateNameButton = new Button("Valider >");
validateNameButton.setUIID("ValidateButton");
Container nameButtons = BoxLayout.encloseX(validateNameButton);
validateNameButton.addActionListener((e) -> {
// ...
});
nameDialog.addComponent(BorderLayout.CENTER, nameTf);
nameDialog.addComponent(BorderLayout.NORTH, hintLabel);
// The buttons will be centered
nameDialog.addComponent(BorderLayout.SOUTH, BorderLayout.centerCenter(nameButtons));
// Shows the dialog in the center of the screen
nameDialog.showPopupDialog(nameButton);
});
So it seems that whenever the TextField looses focus the text disappears. What should I do to show the text contained in the TextField even when the user does not press inside the TextField ?
Please note : the screen captures hide some elements since the app is Top Secret NSA Level ;-).
Any help appreciated,
Actually the issue was coming from the css style where I set the opacity to 255 (like in the theme designer with transparency). It had to be set to a value between 0 and 1.0 indeed.
MyTextFiledStyle {
color: #000000;
background-color: #ffffff;
text-align: left;
opacity: 1.0; /*NOT 255 */
font-family: "native:MainLight";
}

Resources