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);
});
Related
Single GLTF element i can drag and drop. but group of element i can't drag. I am using following code
var loader = new THREE.GLTFLoader();
loader.load( 'W3030/W3030.gltf', ( gltf ) => {
gltf.scene.traverse( function( child ) {
if(child.type === "Group")
{
newObject = true;
GLTFobjects.push(child);
}
if ( child.isMesh ) {
child.receiveShadow = true;
child.castShadow = true;
child.material.transparent = true;
child.material.opacity = 1;
}
});
scene.add(GLTFobjects);
gltf.scene.scale.set(1, 1, 1);
});
I'm afraid instances of Group are not supported by DragControls since there is no Group.raycast() method.
You can implement a workaround by replacing groups with invisible meshes. However, instead of setting Object3D.visible to false, you do this for Material.visible. Otherwise the raycasting logic will not perform the intersection test. It's then necessary to use a geometry that is large enough to enclose the respective children.
three.js R110
Hi Thanks for your support. Now i drag.
Use following code to drag multi mesh GLTF. It is Work for me.
var dragobjects =[];
//add following code in init function
var gltfobject = addGLTFObjectIntoScene();
scene.add(gltfobject);
dragControls = new THREE.DragControls(dragobjects, camera, renderer.domElement);
dragControls.addEventListener('dragstart', onDragStart, false);
dragControls.addEventListener('drag', onDrag , false);
dragControls.addEventListener('dragend', onDragEnd, false);
//end init function code
//add following function after or before init function
function drawBox(objectwidth,objectheight,objectdepth){
var geometry, material, box;
geometry = new THREE.BoxGeometry(objectwidth,objectheight,objectdepth);
material = new THREE.MeshBasicMaterial({color: 0xffff00, transparent: true, opacity: 0,depthTest:false});
box = new THREE.Mesh(geometry, material);
dragobjects.push(box);
box.position.set(0, 0, 0);
return box;
};
function addGLTFObjectIntoScene(){
group = new THREE.Group();
var loader = new THREE.GLTFLoader();
loader.load( 'W1230/W1230.gltf', ( gltf ) => {
mesh = gltf.scene;
mesh.scale.set( 30, 30, 30);
var gltfbox = new THREE.Box3().setFromObject( mesh );
var objectwidth = Math.floor(gltfbox.getSize().x);
var objectheight = Math.floor(gltfbox.getSize().y);
var objectdepth = Math.floor(gltfbox.getSize().z);
objectwidth = objectwidth + parseInt(2);
objectheight = objectheight + parseInt(2);
objectdepth = objectdepth + parseInt(1);
mesh.position.set(0, -objectheight/2, 0);
box = drawBox(objectwidth,objectheight,objectdepth);
group.add(box);
group.name = "quadrant";
console.log(mesh);
box.add( mesh);
});
return group;
};
I am building dynamically more paths in a canvas, and i want to add a tooltip with more details about the path shape. But it looks like the tolltip appears only when i hover the path points. I want it to appear also when i hover the filled area or the contour of it.
PolyLineSegment polySeg = new PolyLineSegment(new Point[] { new Point(triangleX - 8, triangleY - 20), new Point(triangleX + 8, triangleY - 20) }, true);
PathFigure pathFig = new PathFigure(new Point(triangleX, triangleY), new PathSegment[] { polySeg }, true);
PathGeometry pathGeo = new PathGeometry(new PathFigure[] { pathFig });
pathGeo.Transform = new RotateTransform(angleOfTheTriangleInGrades, triangleX, triangleY);
Path path = new Path();
path.Data = pathGeo;
path.Fill = Brushes.Yellow;
var sp = new StackPanel();
sp.Children.Add(new TextBlock
{
Text = "aaa"
});
sp.Children.Add(new Button
{
Height = 20,
Width = 100,
Content = "bbbaaa"
});
path.ToolTip = sp;
pathList.Add(path);
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" });
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'm new with Openlayers, so not sure what is wrong. I can add markers when I change a select drop down and when I click the map. The issue comes when I zoom the map, the markers disappear.
I realised that markers don't disappear, they just move to another place, to the point 0,0.
This is the code
(function($) {
$().ready(function() {
var ZOOM_LEVEL_PROVINCE = 12;
var projection = new OpenLayers.Projection("EPSG:4326");
var map;
var markerLayer;
var initMap = function() {
map = new OpenLayers.Map ("map", {
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Permalink(),
new OpenLayers.Control.ScaleLine({geodesic: true}),
new OpenLayers.Control.Permalink('permalink'),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.Attribution()],
//maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0339,
numZoomLevels: 19,
units: 'm',
projection: new OpenLayers.Projection("EPSG:4326"),
displayProjection: new OpenLayers.Projection("EPSG:4326")
} );
layer = new OpenLayers.Layer.OSM("Simple OSM Map");
map.addLayer(layer);
var point = getLonLatProvince('san-jose');
map.setCenter(point.transform(projection, map.getProjectionObject()), ZOOM_LEVEL_PROVINCE);
}
var initMakerLayer = function(){
markerLayer = new OpenLayers.Layer.Markers( "MarkerLayer" );
markerLayer.id = "MarkerLayer";
map.addLayer(markerLayer);
}
var showMarker = function( province ){
var point = getLonLatProvince(province);
var location = point.transform(projection, map.getProjectionObject());
showMarkerPosition(location);
}
var showMarkerPosition = function( location ){
markerLayer.clearMarkers();
var size = new OpenLayers.Size(21,25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png',size,offset);
markerLayer.addMarker(new OpenLayers.Marker(location,icon.clone()));
var newPoint = location.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
$("#edit-plonlat").val( newPoint );
}
var getLonLatProvince = function( province ){
...
}
initMap();
initMakerLayer();
showMarker('san-jose');
map.events.register("click", map, function(e) {
var location = map.getLonLatFromPixel(e.xy);
showMarkerPosition(location);
});
$('#edit-pprovinces').change(function() {
var selectedPronvince = $(this).val();
var point = getLonLatProvince(selectedPronvince);
showMarker(selectedPronvince);
map.setCenter(point.transform(projection, map.getProjectionObject()), ZOOM_LEVEL_PROVINCE);
});
});
})(jQuery);
I think your call to map.getLonLatFromPixel(e.xh) is getting a location in WGS84 (EPSG:4326) since that is the projection of the map. Then you call showMarkerPosition in your "click" handler. In showMarkerPosition you transform that location from the Google to WGS84 projection, which would change a large lat/lon in meters to a much smaller lat/lon in degrees.
If you've started out with degrees for that meters-to-degrees transform, then I think you'll end up with a lat/lon that's very close to 0,0 off the West coast of Africa.
A projection transform issue is where I always start looking when I see 0,0 lat/lon's.