Custom icons on TiwulFX DetachableTabPane - javafx

We are using TiwulFX for the dockable tabs. Now we are searching how to add custom icons to a DetachableTab. But without any success. Is this even possible to add a icon to the DetachableTab?

I have never used TiwulFX, but looking at the Javadocs, DetachableTab is just a subclass of Tab. So you should be able to use exactly the same method to add a graphic as you do with a regular tab:
DetachableTab tab = new DetachableTab("Tab");
Image image = new Image("path/to/image.png");
ImageView graphic = new ImageView(image);
tab.setGraphic(graphic);

Related

How to use a ROS rviz panel to draw in 3d Scene?

I'm working through the rviz tutorials and am trying to figure out how to use the example code "teleop_panel" to draw in the 3d scene. According to the tutorial this should be possible "A panel in RViz is a GUI widget which can be docked in the main window or floating. It does not show properties in the “Displays” panel like a Display, but it could show things in the 3D scene." But I can't figure out how to modify the source code to actually inject data into the 3d scene (like how the IMUDisplay plugin works).
My use case is that I would like to have a way to have some form of rich qt panel (with controls, indicators, etc) that can connect to other ROS topics and draw in the main 3d scene. I don't believe this is possible with the other options (such as a Display plugin) but I could be wrong.
When starting from the teleop_panel plugin tutorial, add the following members to the TeleopPanel class:
Ogre::SceneManager* scene_manager_;
Ogre::SceneNode* childScene;
rviz::MovableText* helloWorldText;
Next add the following code to the onInitialize() method:
scene_manager_ = vis_manager_->getSceneManager();
childScene = scene_manager_->getRootSceneNode()->createChildSceneNode();
helloWorldText = new rviz::MovableText("Hello World!");
childScene->attachObject(helloWorldText);
helloWorldText->setColor(Ogre::ColourValue::Red);
helloWorldText->setCharacterHeight(2);
helloWorldText->setVisible(true);
And finally to clean up add the following destructor:
TeleopPanel::~TeleopPanel() {
// Destroy the child scene node since we don't need it anymore.
scene_manager_->destroySceneNode(childScene);
}
Now when you load the panel you should see "Hello World!" at 0.0 in the 3D scene.

How to get an icon associated with a certain file type using PyQt/PySide?

I have a QListView that adds a newly added file to a folder using QFileSystemWatcher, however I also want QListView to show the icon for that filetype just as QFileSystemModel would add. I do not want to add any custom icon only the icon that Operating system has registered for the specific to file type.
I just figured out how to achieve this using the code below:
fileInfo = QtCore.QFileInfo(path)
iconProvider = QtGui.QFileIconProvider()
icon = iconProvider.icon(fileInfo)

Next and previous control button in winAPI to go to next page (c++)

I am creating an winAPI application in c++ I have a photo in preview pane and I want to create two buttons NEXT and PREVIOUS on clicking them I will go to the next page .
Could you please give me the idea how to do that in c++ ??
Do I need to use QT libraray or it can be done using the in built function of WinAPI like -
HWND hwndButton1 = CreateWindow(L"BUTTON",L"NEXT",WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,550,800,100,30,m_hwndPreview,(HMENU)buttonid1,(HINSTANCE)GetWindowLong(m_hwndPreview, -6),NULL);
HWND hwndButton2 = CreateWindow(L"BUTTON",L"PREVIOUS",WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,650,800,100,30,m_hwndPreview,(HMENU)buttonid2,(HINSTANCE)GetWindowLong(m_hwndPreview, -6),NULL);
and then using WM_COMMAND for both the button clicks.
Am I going right?
I just want my API application work like a .pdf extension file...as in PDF files we have up and down arrow and on clicking upon them we can go to the next page..In winAPIc++ I couldn't find any such arrow function.. please tell me if there is any such arrow up/down function present to go to next page (because I am very less interested in creating NEXT and PREVIOUS button using createwindow function.. It looks odd).
You have not mentioned what tools you are using, so we don't know if you have a resouce editor. You should research that in a forum appropriate for the tools. If you think writing one line of code to create a button is "very complicated" then you need a better tool.
If you do not want the buttons to appear on top of the picture then you need another place to put them. One common possibility is a toolbar. It is a strip for buttons along the top or bottom of the main window:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb760435(v=vs.85).aspx
With a resource editor you can draw an arrow on the button. Without a resource editor you can set the button text to a unicode arrow:
SetWindowText(hwndButton1, L"\x25bc"); // down arrow, use 25b2 for up arrow
Most buttons (and other controls) are created using a resource editor, placing the controls on a dialog template or a toolbar resource. If you do that Windows will create the buttons when you create the dialog or toolbar. This method is much preferred because Windows will adjust the size of the buttons as required for the screen settings in use.
If you can't do that you must use CreateWindow as you are doing.
Finally it is done.. I have created the buttons neither using Qt or nor using any createWindowEx..The best and easy approach to follow is resource editor ...just put some button on dialog and use IDD_MAINDIALOG (in my case)
m_hwndPreview = CreateDialogParam( g_hInst,MAKEINTRESOURCE(IDD_MAINDIALOG), m_hwndParent,(DLGPROC)DialogProc, (LPARAM)this);
and then
BOOL CALLBACK AMEPreviewHandler::DialogProc(HWND m_hwndPreview, UINT Umsg, WPARAM wParam, LPARAM lParam)
{
switch(Umsg) // handle these messages
{ .........
}
....
}
and thats done. Very easy task.

SWT: custom MessageBox / more text / how to get the icons?

i want to display a second, not bold, text in my MessageBox, like seen for OSX here: http://welcome.solutions.brother.com/NR/rdonlyres/1EA4CC0C-F0B9-45D3-BD2C-EF2C430E3FAD/15107/error2.gif
Is there a way to do this with MessageBox? If not, I would create my own Dialog, problem is that i don't know how to load the appropriate icons.
Unfortunately, MessageBox is fairly constrained in its functionality. You can get the system icon from the Display class and then set it in a label:
final Image warningImage = getShell().getDisplay().getSystemImage(SWT.ICON_WARNING);
final Label imageLabel = new Label(dialogArea, SWT.NONE);
imageLabel.setImage(image);

Font Embedding in Flexbuilder Vs. CS4

I have an all-AS3 Flex project in which I embed fonts. I'm trying to run this project from CS4. However, for some reason the text isn't showing up at all.
The code in the Flex AS3 looks like this:
[Embed(source='C:/WINDOWS/Fonts/ArialBD.TTF', fontWeight = 'bold', fontName='ArialBold', unicodeRange='U+0020-U+0020,U+0021-...')] //a bunch of other unicode
public static var _VerdanaFontBold:Class;
[Embed(source='C:/WINDOWS/Fonts/Arial.TTF', fontWeight = 'regular', fontName='Arial', unicodeRange='U+0020-U+0020...')] //a bunch of other unicode
public static var _VerdanaFont:Class;
And in constructor of the extended textfield in which my text appears I have:
Font.registerFont(_VerdanaFontBold);
Font.registerFont(_VerdanaFont);
I found this article on embedding metadata with Flash, but I couldn't get that to work either (I tried systemFont="Arial" as well as suggested in the comments at the bottom of that article).
So I tried commenting out the above lines and doing it another way. In CS4, I understand that I'm supposed to create a blank textfield in design mode in the FLA file. I then can select fonts to embed in the properties panel. I selected verdana (upper and lower case, punctuation, number, etc). But again when I run the app in CS4, the textfield is blank.
The fact that I'm embedding the font in a blank textfield, and not the one that's called by the document class I've set, shouldn't matter, right? -- the font should just be embedded in the swf and available for use. But it's blank.
Anyone have any ideas?
to embed a font in flash cs4 I would do the following.
in the flash environment, add a font symbol in the library panel. Make sure to click on the "export for actionsctipt button". Note the name of the font class. This will be the name of the font class you will use in your as3 code. Finally click ok and ignore the following warning message.
You can then access this font class from your as3 files. For instance
import flash.text.Font;
...
var titleField:TextField = new TextField();
var myFont:Font = new nameOfFontClass(); // see point 1
var format:TextFormat = new TextFormat();
format.font = myFont.fontName;
titleField.defaultTextFormat = format;
titleField.embedFonts = true;
hope this helps

Resources