I'm trying to create two panes inside a tab bar programmatically using the following code:
var middlePanel = new LayoutPanel
{
Orientation = Orientation.Vertical,
DockHeight = new GridLength(250)
};
rootPanel.Children.Add(middlePanel);
var paneGroup = new LayoutAnchorablePaneGroup
{
DockHeight = new GridLength(200)
};
middlePanel.Children.Add(new LayoutDocumentPane());
middlePanel.Children.Add(paneGroup);
var validationEditorPane = new LayoutAnchorablePane();
paneGroup.Children.Add(validationEditorPane);
validationEditorPane.Children.Add(new LayoutAnchorable { ContentId = "Validation", Title = "Validation" });
var searchEditorPane = new LayoutAnchorablePane();
paneGroup.Children.Add(searchEditorPane);
searchEditorPane.Children.Add(new LayoutAnchorable { ContentId = "Search", Title = "Search" });
However, the code above creates the two panes next to each other without tabs. During runtime I can drag the Search pane onto the Validation pane to move them into tabs. This suggests that it must be possible to achieve this programmatically, but I cannot see how.
Any suggestions?
This turned out to be easier than I thought. All I had to do was to add the LayoutAnchorables to the same LayoutAnchorablePane object:
var tabPane = new LayoutAnchorablePane();
paneGroup.Children.Add(tabPane);
tabPane.Children.Add(new LayoutAnchorable { ContentId = "Validation", Title = "Validation" });
tabPane.Children.Add(new LayoutAnchorable { ContentId = "Search", Title = "Search" });
Related
I have a lot of qx.ui.menu.Button and I want to add a scrollbar to it, how can I do it?
`var menu = new qx.ui.menu.Menu();
var button1 = new qx.ui.menu.Button("Line 431");
var button2 = new qx.ui.menu.Button("Line 30");
var forwardButton = new qx.ui.toolbar.SplitButton(
"Next",
null,
menu
);
var forwardButton2 = new qx.ui.toolbar.SplitButton(
"Next2",
null,
menu
);
//buttons should go one after another
//scroll = new qx.ui.container.Scroll();
//scroll._add()
this.getRoot().add(forwardButton);
this.getRoot().add(forwardButton2, {top: 30});`
the scrollbar should be like it exists for qx.ui.list.List
The solution is to use combination of Popup and List widgets:
// Create a button
const button1 = new qx.ui.form.Button("Click me", "test/test.png");
const model = new qx.data.Array(["a", "ab", "abc", "abcd", "abcde", "abcdef", "abcdefg", "abcdefgh"]);
const list = new qx.ui.list.List(model);
list.addListener("changeValue", function(value){console.log(value)}, this);
const popup = new qx.ui.popup.Popup(new qx.ui.layout.Grow());
popup.add(list);
// Document is the application root
const doc = this.getRoot();
// Add button to document at fixed coordinates
doc.add(button1, {left: 100, top: 50});
// Add an event listener
button1.addListener("execute", function() {
popup.show();
popup.placeToWidget(button1);
});
I'm using drupal7 Photoswipe module which uses Photoswipe jQuery plugin to build a view and display a gallery of photos.
Currently Photoswipe allows only to display image title as image caption.
Also to display other text fields from the same content node, I add content text fields to the view and change their display to add a CSS class (.photo_text).
Then I modified openPhotoSwipe function within photoswipe.jquery.js to get the image parent html node ($image .parents("td:first") ) and select it's children having the (.photo_text) CSS class, to add them as image title.
openPhotoSwipe: function(index, galleryElement, options) {
var pswpElement = $('.pswp')[0];
var items = [];
options = options || Drupal.behaviors.photoswipe.photoSwipeOptions;
var images = galleryElement.find('a.photoswipe');
images.each(function (index) {
var $image = $(this);
var $eleme = $image.parents("td:first");
var $eleme_class = $eleme.children('.photo_text');
var $photo_text = "";
if ( !!$eleme_class){
for ( var i = 0; i < $eleme_class.length; i++ ){
$photo_text += $eleme_class[i].innerHTML;
}
}else{
$photo_text = "";
}
// end of add
size = $image.data('size') ? $image.data('size').split('x') : ['',''];
items.push(
{
src : $image.attr('href'),
w: size[0],
h: size[1],
title : $image.data('overlay-title') + $photo_text
}
);
})
I'm now wondering if it exists a simplest way to do the same thing without modifying this module?
I have a directive to have a sorting icon on a table column (fa-caret-up, fa-caret-down) When i mouseenter on the column header, it should show opposite direction of existing otherwise default direction desc.
I am able to get the events click, mouseenter and mouseleave.
Now the problem is, when you go over a column to click, triggering is not appropriate and it is removing sort icon.
Is there a way to combine both click and mouseenter events to trigger first click and mouseenter event next?
This is my code.I need to implement something like ele.bind("click mouseenter") or order events click then implement mouseeneter:
var upSortClass = "fa fa-caret-up";
var downSortClass = "fa fa-caret-down";
var iconClass = ".icon-sort";
var addIconClass ="";
var removeIconClass ="";
ele.bind('click', function () {
var ic = ele.find(iconClass);
ic.addClass(addIconClass);
addIconClass ="";
});
ele.bind('mouseenter', function () {
var ic = ele.find(iconClass);
var sortUp = ic.hasClass(upSortClass);
var sortDown = ic.hasClass(downSortClass);
if(sortUp) {
addIconClass = upSortClass;
removeIconClass = downSortClass;
ic.removeClass(upSortClass);
ic.addClass(downSortClass);
}
if(sortDown) {
addIconClass = downSortClass;
removeIconClass = upSortClass;
ic.removeClass(downSortClass);
ic.addClass(upSortClass);
}
if(!sortUp && !sortDown) {
removeIconClass = downSortClass;
ic.addClass(downSortClass);
}
});
ele.bind('mouseleave', function () {
var ic = ele.find(iconClass);
ic.removeClass(removeIconClass);
ic.addClass(addIconClass);
addIconClass ="";
removeIconClass ="";
});
please guide.
Thanks in advance.
I would like to have checkBoxes inside a comboBox, like in this simplified example :
var rawData = [];
for (var i = 0; i < 20; i++) {
rawData.push(i);;
}
var data = new qx.data.Array(rawData);
var list = new qx.ui.form.ComboBox();
list.setWidth(150);
this.getRoot().add(list);
var controller = new qx.data.controller.List(null, list);
var delegate = {
createItem : function() {
return new qx.ui.form.CheckBox();
}
};
controller.setDelegate(delegate);
controller.setModel(data);
It's working but i'm not able to "check" the checkboxes because the combobox is closed when i click on it, so i would like to open/close the combobox only with the button.
How to do it? Thanks in advance.
Some event of the ComboBox is responsible for closing the PopUp (see code on GitHub) before the click can get to an underlying checkbox. If you implement your own ComboBox and overwrite the close method it works.
qx.Class.define("foo.ComboBox", {
extend: qx.ui.form.ComboBox,
members: {
close: function() {
}
}
})
var rawData = [];
for (var i = 0; i < 20; i++) {
rawData.push(i);;
}
var data = new qx.data.Array(rawData);
var list = new foo.ComboBox();
list.setWidth(150);
var controller = new qx.data.controller.List(null, list);
var delegate = {
createItem : function() {
return new qx.ui.form.CheckBox();
}
};
controller.setDelegate(delegate);
controller.setModel(data);
this.getRoot().add(list);
However now you have to think about how you will handle multiple selection of checkboxes and when to close the popup.
I try formatting text in richTextBox, something like in skype chat.
1.column-"Nick" 2.column-"Text of Messange" 3.column-"DateTime"
I want alling 1. column max left and 3. column max right.
What is the best way how can I do it? I am using WPF.
My solution:
Simple solution is create Table object and add to blocks of richtextbox, somothing like this:
var tab = new Table();
var gridLenghtConvertor = new GridLengthConverter();
tab.Columns.Add(new TableColumn() { Name = "colNick", Width = (GridLength)gridLenghtConvertor.ConvertFromString("*") });
tab.Columns.Add(new TableColumn { Name = "colMsg", Width = (GridLength)gridLenghtConvertor.ConvertFromString("5*") });
tab.Columns.Add(new TableColumn() { Name = "colDt", Width = (GridLength)gridLenghtConvertor.ConvertFromString("*") });
tab.RowGroups.Add(new TableRowGroup());
tab.RowGroups[0].Rows.Add(new TableRow());
var tabRow = tab.RowGroups[0].Rows[0];
tabRow.Cells.Add(new TableCell(new Paragraph(new Run(rpMsg.Nick))) { TextAlignment = TextAlignment.Left });
tabRow.Cells.Add(new TableCell(ConvertToRpWithEmoticons(rpMsg.RpText)));
tabRow.Cells.Add(new TableCell(new Paragraph(new Run("Cas"))) { TextAlignment = TextAlignment.Right });
RtbConversation.Document.Blocks.Add(tab);