SWT: custom MessageBox / more text / how to get the icons? - 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);

Related

How can I change the font of the Time4J CalendarPicker in JavaFX?

Is there a way to change the font of Time4J CalenderPicker in css-style?
I needed a Persian DatePicker in my program so i used Time4J CalenderPicker.
using this code i could change only the font of cells:
CalendarPicker<PersianCalendar> MyDatePicker = CalendarPicker.persianWithSystemDefaults();
MyDatePicker.setCellCustomizer(
(cell, column, row, model, date) -> {
cell.setStyle("-fx-font-family: MyFont;");
}
);
I tried this code but nothing changed:
MyDatePicker.setStyle("-fx-font-family: MyFont;");
But i want to change the font of hole CalendarPicker.
In order to apply the changes, you need to use the following code and set new css styles for calender picker and applying the customizations.
private CalendarPicker<PersianCalendar> MyDatePicker = CalendarPicker.persianWithSystemDefaults();
MyDatePicker.getStylesheets().add("/MyCSS-Style.css");
The following gif, demonstrates my customizations.
The calendar picker itself is only the combination of a text editor and a popup button (bundled in a HBox). However, the calendar view is another component which pops up if users press the button. And this component whose font you wish to change is not yet publicly accessible (with the exception of the cells via a special customizer).
I agree that this should be more flexible. Therefore I have opened a new issue to track this request for enhancement.
Feel free to fork Time4J and do your experiments and submit a pull request on time4j-github. Actually I am busy with other things but can look deeper then.

InlineCssTextArea (RichTextFX) current style?

I'm trying to achieve something like rich text editor in javafx, using RichTextFX library component: InlineCssTextArea.
I've expect an API similar to this:
InlineCssTextArea area = new InlineCssTextArea();
area.setStyle("-fx-font-weight: bold;");
//now user input is bold
area.setStyle("text-decoration: underline;");
//now user input is bold and underlined
area.setStyle("-fx-font-weight: normal;");
//now user input is just underlined
But it seems, that all style changes has to be applied to a range of characters. Did I miss something? This use case seems to be the most natural one.
Do I have to track current carret position, and apply changes accordingly?

Custom icons on TiwulFX DetachableTabPane

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);

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.

Resources