I'm trying to create structure to draw many graphs in separate sub windows one below another, something that looks like that :
I need to change the size of these graph by dragging lines separating them.
I tried using panes in wxAUI but resizing one affects other, and it seems to be rather unstable. The main problem is that when I'm moving one sash to another it starts pushing it. Maybe there is some way to solve it?
I also tried using multiple wxSplitterWindow each nested in another, but this strategy also seems to fail because resizing one window affects all nested inside and their splitters are moving due to sizing even if I try to cach event EVT_SPLITTER_SASH_POS_CHANGED.
Do you have any ideas how to solve that?
I'm afraid there is indeed no out of the box solution doing what you need. wxSplitterWindow itself is implemented using wxWidgets API, so you could adapt its code to create your own window supporting multiple splitters, AFAICS it should be quite straightforward but, still, will require some work.
Related
I wonder how to draw the lines connecting the items in a QTreeView as illustrated in the picture under Tree Model. My program will run on different platforms and thus use different styles. Can I guarantee that the items are drawn as desired?
I feel, using style sheets might be problematic because certain styles do not print such lines and using a delagate might lead me into issues of double drawing.
There's an example in the documentation here showing exactly what you want to achieve using style sheets.
Please note that when you use style sheets QStyleSheetStyle kicks in, irregardless from the QStyle your application is using at the moment. So if you decide to go this way you will override the look and feel of your control the same way, irregardless from the target platform.
If that is a problem, you may consider to use style sheets only for certain platforms. As an example:
#ifdef Q_OS_MAC
myControl->setStyleSheet(":/my_stylesheet_for_mac.qss");
#endif
Back to the example in the documentation, it uses a few images containing all the various lines (vertical, horizontal, branch, etc) and the ::branch subcontrol and its states to determine which image to use.
The result is something like this:
.
Obviously, you must change the code to show the vline picture instead of the arrows.
As a side node, I may suggest to consider why you want to do this if you are using native styles. If your application has a native look and feel, you should not alter it in any way. That is, if the target platform doesn't render lines to connect tree view items, then you shouldn't add those.
However, if your application is not required to look native across all the target platforms, you may consider using the same style (e.g. Fusion) and deliver the same user experience no matter what the platform is.
I'm using a QListView with a custom model derived from QStringListModel to display a large series of images, or, to be more specific, data curves. I used to use QListWidget, but I have so many of them that setting the icons (quite high res) for all of the items just takes all the memory, and cause a very long startup time. I thought that switching to QListView with a custom model would solve the problem (and it does solve the memory problem), but not the long startup time, as all the icons are requested by QListView at startup (I see that by just writing the names on the terminal).
Do you have any way to work around this ? The best I can think of for now is to have a thumbnailer thread that trashes its queue when it gets too large, but that seems very cumbersome.
It turns out that, in my case, it is rather simple:
list->setUniformItemSizes(true);
This way, the QListView doesn't have to look at all icons to know their size.
I try to make fancy looking messages viewer, where messages divided by formatting, other background of smth. similar. They need to looks like this - http://pastebin.com/GU1Lq087. What I found in wxWidgets to solve this problem, and why I can't use it:
wxHtmlWindow
Supports minimal HTML (a few tags). But big problem with this - html representation doesnt fill parent window. So element with width=100% will have 100% width only on standard window size. And even p tag doesnt have word wrapping (long long paragraph goes in one line with vertical scroolbar).
wxWebWiew
I need to have the ability to set generated HTML to it, but IE must to load some page first and I can rely only on IE background. It has some time to load page, even if I set HTML-string.
wxRichText
Most suitable for me. But I can't draw line like HTML's hr, or change background for the entire message block (to distinguish it from common background)
I need to show messages like this. But i didn't know how and which tool is better.
One way of achieving this would be using wxWebView with WebKit backend but I am afraid that Windows can only use IE's engine. However, there is project which allows you to use Gecko engine. I use WebKit for rendering chat in my application and it works really good (although I am using Qt). (http://www.kirix.com/labs/wxwebconnect.html)
You can always do it regular way - just create separate widget (I think it is called "frame" in wxWidgets) for single message. This way you get almost infinite possibilities. E.g. you can make "AbstractMessage" with virtual methods and then things like "AdministratorMessage", "MOTD" etc. will be a breeze.
wxRichText Most suitable for me. But I can't draw line like HTML's hr
Really? Have you looked at the docs?
( http://docs.wxwidgets.org/trunk/overview_richtextctrl.html )
Here's a couple simple ideas:
a. Write a line of blanks, underlined.
http://docs.wxwidgets.org/trunk/classwx_rich_text_ctrl.html#a333b2e675617ed2299cf91e7c0dbd0d8
b. Create an image of a horizontal line, display it using WriteImage
http://docs.wxwidgets.org/trunk/classwx_rich_text_ctrl.html#a1315611c0741d03e852ee26eba3a9d94
The funny thing is that what you want can be done using any of the 3 controls you mention. With wxHtmlWindow you just need to set its size correctly, with wxWebView I don't understand what your problem with it is at all and with wxRichTextCtrl you could just use separate controls for the areas with different backgrounds (you could almost certainly use a single control with different styles but using several controls seems simpler).
I've been playing around with SketchFlow from Microsoft and one thing that bothers me is that I cannot seem to find a window looking like sketch.
I would like it to have title bar and 3 "buttons" like all normal windows do (minimize, maximize, close buttons).
In Balsamiq Mockups this is very easy, however I don't see any kind of window-like sketches in SketchFlow.
I'm trying to mockup future desktop application.
You are correct that there isn't one built in. In SketchFlow you can easily make "component" screens that can be used multiple times. To create what you are looking for you could combine a sketch rectangle, with a couple of buttons and a textbox. You can select all of this content, right click it and make it into a component screen.
The MockupsLibrary also provides the mockups you are looking for. Once you've installed it, it'll appear in your assets as "ButtonWithIconMockup". You can select the "WindowMinimize", "WindowMaximize", and "WindowClose" for your IconImage attribute to get the desired result.
With Expression Blend 4, you can install the Mockup Controls by following the instructions at How to add mockup controls to your Expression Blend library. In the new Assets | Mockups category you will see a WindowMockup item that does exactly what you wanted.
To play around with the Mockup Controls, try the MockupDemonstration sample from the Help Welcome screen.
Unfortunately, there doesn't seem to be a builtin MenuStrip yet (although you can laboriously build one yourself from the non-sketchy SimpleMenu and SimpleMenuItem controls)? Also there doesn't seem to be any support for indicating keyboard accelerators (prefixing the desired letter with & doesn't work).
In general, it seems like Sketchflow really isn't designed to be used to prototype standard desktop applications?
I am using wxWidgets and Visual C++ to create functionality similar to using Unix "tail -f" with rich formatting (colors, fonts, images) in a GUI. I am targeting both wxMSW and wxMAC.
The obvious answer is to use wxTextCtrl with wxTE_RICH, using calls to wxTextCtrl::SetDefaultStyle() and wxTextCtrl::WriteText().
However, on my 3ghz workstation, compiled in release mode, I am unable to keep tailing a log that grows on average of 1 ms per line, eventually falling behind. For each line, I am incurring:
Two calls to SetDefaultStyle()
Two calls two WriteText()
A call to Freeze() and Thaw() the widget
When running this, my CPU goes to 100% on one core using wxMSW after filling up roughly 20,000 lines. The program is visibly slower once it reaches a certain threshold, falling further behind.
I am open to using other controls (wxListCtrl, wxRichTextCtrl, etc).
Have you considered limiting the amount of lines in the view? When we had a similar issue, we just made sure never more than 10,000 lines are in the view. If more lines come in at the bottom we remove lines at the top. This was not using WxWidgets, it was using a native Cocoa UI on Mac, but the issue is the same. If a styled text view (with colors, formatting and pretty printing) grows to large, appending more data at the bottom becomes pretty slow.
Sounds like the control you are using is simply not built for the amount of data you are throwing at it. I would consider building a custom control. Here's some things you could take into account:
When a new line comes in, you don't need to re-render the previous lines... they don't change and the layout won't change due to the new data.
Try to only keep the visible portion plus a few screens of look-back in memory at a time. This would make it a little lighter... but you will have to do your own scroll management if you want the user to be able to scroll back further than your look-back and make it all appear to be seamless.
Don't necessarily update one line at a time. When there is new data, grab it all and update. If you get 10 lines really quickly, and you update the screen all at once, you might save on some of the overhead of doing it line by line.
Hope this helps.
Derive from wxVListBox. From the docs:
wxVListBox is a listbox-like control with the following two main differences from a regular listbox: it can have an arbitrarily huge number of items because it doesn't store them itself but uses OnDrawItem() callback to draw them (so it is a Virtual listbox) and its items can have variable height as determined by OnMeasureItem() (so it is also a listbox with the lines of Variable height).