ZoomedOutView with disabled keys - xaml

Does anybody know how to reproduce the ZoomedOutView like in the following picture:
Picture http://img690.imageshack.us/img690/2981/84364982.png
I have a solution that probably works but I think we can do that differently.
My solution :
Add all the keys in the binded and grouped collection
Create a converter Int32 to Booleab
Bind the enabled property to Group.Values.Count and apply the converter
Modify the GridViewItem style to change the Background property
Is there an easier way to do that ?
Thanks in advance

Those steps sound about right and should be the most straightforward way to get to what you want.
One place you might run into trouble is with getting the Group counts. Depending on what you're using for grouping you may get an IEnumerable with only the Count() extension method available and not a real Count property that would be bindable. This would be the case if you were using LINQ's GroupBy for example.

Related

wxGrid - RefreshBlock Undocumented Member Function

In order to refresh a part of the grid, i.e., when font or alignment changes, I was using the following approach:
wxRect rect1=CellToRect(TopLeft);
wxRect rect2=CellToRect(BottomRight);
wxRect r(rect1.GetTopLeft(), rect2.GetBottomRight());
RefreshRect(r);
This was refreshing only a part of the intended block and was not working correctly.
From the suggestions of intellisense I came across RefreshBlock function and it works correctly. I searched the docs and have not found any information on it. I wonder if it is not recommended to use RefreshBlock for some reason? What does RefreshBlock do, does it refresh a block (as the name suggests) or is it equivalent to Refresh?
I am using wxWidgets 3.2 on Win10.
Thanks in advance.
The function RefreshBlock() is indeed the best way to do what you want and it was only undocumented by mistake, i.e. we simply forgot to do it. I've added documentation for it only now, so it will only get included in 3.2.1, but you can still use it in your code, the function itself is available since 3.1.3.
It seems from the source code that, depending on the location of its parameters, RefreshBlock refreshes any of the following:
corner grid
frozen cols grid
frozen rows grid
main grid
Since the area I wanted to refresh was on the main grid the following approach works (the idea is similar to RefreshBlock's approach):
auto GridWnd = CellToGridWindow(TL);
wxRect rect = BlockToDeviceRect(TL, BR, GridWnd);
GetGridWindow()->RefreshRect(rect);
Now everything is refreshed correctly.
Notes:
If only RefreshRect(rect) is called, things will NOT work as expected.
Little experiment showed that BlockToDeviceRect(TL, BR) also works, therefore eliminating the need for auto GridWnd = CellToGridWindow(TL);

VB.NET How do I pass parameters to a class?

Relatively new to coding and have taken up lots of small projects to help learn the basics, and I have now set myself a challenge of a "bigger" one. Essentially I want to recreate the Message Box but with my own styling and customisable elements.
I have got the basics in a class and created it, however I want the class to have two options.
1) load all the details from an XML file for the message, I have done this and that works.
2) I want it to be like the standard message box where you can pass in parameters.
My question is, How can I achieve number 2.
I have tried adding details into the Show/Load subs but no luck, the only way around it I can see is with properties but that would take too long.
I want to be something like the below.
classname.show("message","tittle",icon,"buttons",imagefile,"caption")
However alot of my code is done in the load method as opposed to show, so it needs to be visible / accessible there.
Any help / advice would be appreciated.
Properties are definitely the way to go. It also makes sense: Conceptually, the message being shown is a property of the message box.
Your Show method would look like this:
Public Shared Show(message As String, title As String, ...)
Dim box as New MyMessageBoxWindow()
box.Message = message
box.Title = title
...
box.ShowDialog()
End Sub
In the Load method of MyMessageBoxWindow, you access these properties and configure the UI elements.

Simplest possible way to show two items NSTableView from code?

How I can create a code in XCode 4.2.1 what will create NSTableView and add just couple of items to it?
All what I wanted to do is:
1) Window where is NSTableView
2) I have an array of strings in NSArray which I like to show in that NSTableView
3) All of this should be done in code. So I don't want to learn how to add this action happen when you press button (I know already how to do actions when user click buttons etc), I just want that application launch -> draws the table where is those items from my array. That's it, nothing more.
And yeah I have understood that I do not add items to NSTableView directly. That is not the point in this question. I just mean that I want to show couple of items in that table but I have no and kind of clue WHERE I should add my data from my array.
I have tried to google for example pages for hours (just too many and have not find help) but I will always be stucked in the part when
a) I must do something in the Interface Builder and the images of the interface builder are from version 2.x or 3.x and I have 4.2.1 and it is totally different (new to XCode...). Surely I have drawn my TableView element to UI but I mean delegations etc. Are those necessary at all? Can those be made from source code?
b) Code just does not work anymore because language (Cocoa or Objective-C, I don't know) has changed and I don't know how and what I have to do to make it work on newest version of XCode.
c) There is too much different ways told: "use binding", "you must create new class what is NSTableViewDataSource" etc. I have no any kind of clue what is preferred way, is another way optional or it is "you should use this because another is going deprecated soon" or something.
So please, can somebody give help in step-by-step what I exactly have to do? Should I create some bindings? If so, how and where? Do I have to create DataSource component myself? Are those ways valid any more? If I have to, how I can create it? Create a new class and implement it as a NSTableViewDataSource and then use it? Is that way valid any more and if it is, can sombody show code what is as simple as possible?
I have also checked Apple Documentation page many many times, checked those example codes but there is just too much totally unrelated stuff that I just don't understand at this point so they are totally useless (I mean, I don't know what is required for this task, what are not etc.
I would be very happy if somebody can help short tutorial step-by-step what to do. I mean "step-by-step" like:
1) Create new project
2) Draw NSTableView in project
3) Create new class with this name
4) Write this code: blah blah blah
5) Create another class with this name
6) Write this code
7) Run and see those items from array in NSTableView using (bindings/datasource/whatever is preferred).
Thanks :)
Your tableview needs a datasource. Your datasource is a custom class, it implements the "NSTableViewDataSource" protocol. This protocol contains a few methods that you can use to tell the tableview what data you got.
this includes the objectValue ( the value of the NSCell that is displaying your data on the specified row, and a method that returns the amount of rows the tableview has ( the amount of items in your array ).
Here a tutorial I found by googling:
CocoaDev.com NSTableView tutorial
You can also implement the NSTableViewDelegate protocol which allows some greater control. Like what rows you can select, or some extra configuring of a custom tableview cell.
I must say that back in the day when I started developing desktop applications ( only had experience with web technologies ) that this design pattern confused me as well. Hope you will get your mind round it soon.

Example for custom Range in Gtkmm

I am working on a Potentiometer style widget in Gtkmm and I'd like to use Range as the baseclass.
Does anyone know of a proper example for doing this?
I'm not sure exactly what you're asking for. I know that there is a simple example of using the range widget here. It does handle the creation of the Adjustment object that you'll need. You'll need to define an abstract potentiometer class, then create your vertical and/or horizontal potentiometers separately for flexibility.
The closest thing that I could find to an example of what you'd need to override in order to make your own custom range-like widget is on Old Nabble.
I wish that I could give you more help with this, but I'm rather new to Gtkmm.

NSTableView, multiple cells and bindings

I'm trying to create a view that's similar to Motion's properties views.
Each of my property objects contains a definition of the kind of cell it wants to display as. But at the same time, I'd like to use bindings so that values are automatically updated as they can be changed elsewhere.
I've tried a few different approaches to the problem.
Multiple cells and dataCellForTableColumn: while this allows rendering to happen properly for all cell types, I lose bindings.
NSProxy: I've also tried using a proxy object that I thought would forward all methods to the selected cell type behind it, but again, bindings don't seem to work here.
Has anybody had any experience with this kind of problem before? Or is this one of the cases where bindings isn't going to cut it, and I'll need to do the heavy lifting myself?
Cheers!
I haven't actually tested it, but you shouldn't be losing bindings when you use dataCellForTableColumn:row: ? Can you describe in a bit more detail what you've tried with respect to bindings?
You should be able to set the column's value binding to the "value" property of your object. Then if you return the correct type of cell in dataCellForTableColumn:row: it should display correctly.
Edit: --- deleted gratuitous incorrect advice about cells vs views :)