JavaFX request layout does nothing - javafx-2

I'm absolutely confused.
Studying JavaFX for several months.
In my application I have a custom scrollpane, where I recount scrollbar values manually. Everything is OK there. And when I resize the window it also works fine.
The problem appears when I launch application the first time. I see that my scrollbar value is incorrect, and it become correct when I resize window or move the pane placed inside scrollpane.
So theoretically all i need is just update my scrollpane on window start, or after window start. And... I've spent more than week trying to find out how. And the only way I've managed to do this is to call layoutChildren recursively. This is awful of course.
layout() - doesn't have any effect. I tried it with runLater() and placed it inside timer call. No way!
requestLayout() - also makes no sense.
Is it possible just UPDATE or REDRAW or MARK CONTROL TREE AS DIRTY in JAVAFX ???

Ok well, try this way
first gaining the focus, then try relayout options..
blah.requestFocus();
blah.layout();

Well. layout() works. But it shouldn't be placed inside Platform.runLater().
In simple example everything is fine. Then I suggest I have something wrong with my controls.
Thanks.

Related

Glimpse screen takes up the whole page. How to resize it?

I have an irritating problem with Glimpse.
I wanted to see everything I can on a Glimpse tab so I maximised it's size on the page.
Now I cannot resize it back again. There is no edge I can drag down. I am sure there is a simple way of sorting this. I tried switching off Glimpse, but when I switched it back on again it was taking up the whole screen again. I don't want to install and uninstall, so how do I fix this easily?
I am using ie10
I find a way of fixing this, which is to go into Developer Tools and change the css settings dynamically by using the CSS top class, replacing another class like margin, and putting in 200px and then resizing from that.
Another option is launch the Glimpse as Standalone tool.

MergDataGridScroller: How to save + restore position?

Is there an easy way to save the vertical/horizontal scroll position of the datagrid scroller used inside the MergDataGridScroller? Want to be able to go back to the same card and have the datagrid open at the same location as it previously was.
It seems that the datagrid scroller is created/destroyed on the open/close-Card cycle, otherwise I could just hide it.
Perhaps this is one of those situations where it's easier to "roll my own"?
Any help appreciated - thanks!
Yes the scroller is created and destroyed as you open and close cards. I think this is something that should be supported but isn't currently. Basically it's just a matter of not resetting the scroll of the group and then setting the native scroller to the scroll of the group when it's created. Should just be a couple of tweaks to the handleLayout command in the behaviour. I'm not sure about maintaining scroll when the content rect changes. I can look at that too.
So in answer to you question rather than roll your own you have a couple of choices:
Wait for me to do it and release a new version
Edit the behaivior script with whatever changes you like
EDIT
I've done this now ;-)

C# ListView Image/Icon margin/padding

Is it possible to reproduce what is on the picture below in ListView, padding/margin icon to the right.
http://img801.imageshack.us/img801/4043/listview.png
My first question here, so I couldnt post the picture here.
Basically I need to move the ListView icon more right, I am reproducing file/directory browser, so the fails that are in a directory need to be below them and slighty right like in the picture, I have everything else figured out.
You should be using a TreeView control:
http://msdn.microsoft.com/en-us/library/1dtsdfkx.aspx
But if you insist on hacking a ListView to render this way, you'll simply have to take over drawing each row yourself. You can do so using the OwnerDraw property, though be warned that there's a lot of corner cases here so you should do a lot of reading to see what people have had to deal with when implementing this:
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.ownerdraw.aspx

Howto prevent a CFrameWnd from being mouse moved

I have an application that displays a CFrameWnd that is displayed on top of the main window. I need the window to be non-movable and non-resizable when the user selects a certain mode for the window.
My CFrameWnd is created with the styles WS_OVERLAPPEDWINDOW | WS_THICKFRAME | WS_POPUP
I have come across a solution using an overload of CWndOnNcHitTest to rewrite
HTLEFT,HTRIGHT,HTTOP,HTTOPLEFT,HTTOPRIGHT,HTBOTTOM,HTBOTTOMLEFT,HTBOTTOMRIGHT,HTSIZE,HTCAPTIONto HTBORDERto prevent the framework to recognize the areas responsible for sizing / moving.
This method works well for resizing in my case, but moving the window is still possible, although the hittest override works correctly (verified with traces).
Is there anything wrong in my approach, or could there be something interfering with this solution and if so, do you have any tips on where to look?
You should be able to make OnNcHitTest() work, don't return HTCAPTION.
Still, there's more than one way to move/size a window, you also have to worry about the system menu (type Alt+Space). Write a message handler for WM_MOVING and WM_SIZING and override the RECT so the window stays put.

Problems with refreshing a draggable MFC window

Greetings.
I have to make a draggable MFC dialog window, which has a background - used that: http://www.codeproject.com/KB/graphics/picturewindow.aspx - and has several picturebox controls. I have tried two approaches, and while they do work, they have some problems.
First approach is "Manual" - on the LBUTTONDOWN message I check if it;s on a clean area of my window, and set a flag variable. On MOUSEMOVE, the flag is checked and if it's set, a MoveWindow function is called, and then, Invalidate(1). On LBUTTONUP, flag is unset.
This approach works correctly and redraws as needed, but is somehow very slow - if I'm moving the cursor too fast, the window falls behing and isn't dragged, as cursor's not over the window anymore.
The second approach is "Automatic" - I just call
DefWindowProc(WM_SYSCOMMAND, SC_MOVE+2,MAKELPARAM(point.x,point.y));
on LBUTTONDOWN, and it handles the rest, it's quick and never fall behind, but when I drag it over screen's edge ( so that some part of the window gets invisible), when I drag it back, all the controls get invisible and are not refreshed, background is okay. I suppose that's because Invalidate() isn't called during movement that way, as I actually call it after calling DefWindowProc() and so, everything is refreshed properly when I depress the button.
What should I do to improve either of those solutions? I need it both fast and correct. I may have not provided some required information, I'll add it is need arise.
Thanks in advance.
Solved the problem, by modifying the second way. I added a total redraw to the OnPaint(), and to get rid of flicker, I only redraw durng dragging, by using a flag variable.

Resources