FLTK's Fl_Scroll - run code in reaction to scrolling happening? - fltk

I am using FLTK 1.3, displaying a single Flex column with a number of Flex rows inside a Fl_Scroll. I want to do something to rows that were outside of the visible area when they scroll into view. But I cannot figure out how to do that. There is no event emitted when the scroll position changes (as far as I can see) nor does a callback on the scroll seem to do anything.
The only solution I can think of is something like using the column's, scroll's, or window's callback to get informed of all UI events (such as move, key up, leave, ..) and use them to check whether the scoll's yposition has changed from the last time and run the code I need if it is....
But there surely must be a better way?
Thank you!!!

Related

movableColumns and <select> in customEditor

I have a customEditor with a <select> in it. When I turn on movableColumns, and the user clicks the <select> and still has the MouseDown as they scroll down the list, the column want to move.
Though I havent looked in the code of Tabulator, I would be willing to bet it on the combination of events of MouseDown and MouseMovement within the element are being triggered (though when I test it with the default editor and "select" text to Copy or Paste, it doesnt trigger it, but that might have something to do with focus() as well)
If I'm careful to click on the <select>, release the button, and then move the pointer to the option, the column doesn't attempt to move. Even if after the initial MouseUp, I can then MouseDown and move the pointer all I like, the column wont want to move. So again, I think it has something to do with the <select> then taking focus() and the MouseEvents not being propogated up the tree ?
For the moment, I've disabled movableColumns to reduce user frustration, even though I've explained to them the behaviour (do users EVER listen ?!?!) until a solution is found.
Addendum : it's not just MouseClick and MouseMove. if I MouseClick and hold (perfectly) still, a timer fires off and it wants to move the Column.
You will need to use a e.stopPropagation() and a e.stopImmediatePropagation() to prevent the event bubbling out of the editor

JavaFX request layout does nothing

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.

MonoTouch Dismiss Keyboard (sort of)

I am writing a MonoTouch iOS app. I have read many postings about ResignFirstResponder and I am using that.
My app is a typical table view app. I have done my own custom table cell view. The UITextField controls that cause the numeric keypad to come up in the first place are all on the custom table cell.
Currently I have it so that if you tap on the background of the cell I call ResignFirstResponder on all the text fields. This seems to work, but is not intuitive. I had a new beta tester get it last night and he tapped on one of the text fields and the keypad came up and he was lost as to how to get rid of it. After I told him to just tap the background, he now is fine, but obviously I want a solution that is obvious and doesn't require me to tell everyone how it works.
I read one post about a way to add a DONE button to the keypad, but it looked like a total hack and even broke when 3.2.1 came out and I don't want to have to worry about my app breaking when a new OS comes out.
Suggestions?
I would keep the background click->ResignFirstResponder that you have already, but add to it.
Curious, what button do you have set in the bottom right of the keyboard? There are options to show a Done, Search, Go, Next etc. buttons that can be setup to ResignFirstResponder. Pick the button that makes sense in your situation.
You can hook into the bottom right button by setting a callback to UITextField.ShouldReturn and calling ResignFirstResponder. You can just return false (that return value is for allowing line breaks in your UITextField).
Found an example here of hooking up ShouldReturn.

Magnifier like feature inside popup window....how to?

I need to create a magnifier like feature in my app. Like the "loupe" effect on the iphone !
The problem is that I need to do that inside a popup window and I don't get how to make it work !
The popup window display a grid of colors that I generate and draw one by one using shapeDrawables. What I want is to display that color bigger, zoom on it when the user touch and move his finger around the popup window (color grid). The idea is to create a tracking-zooming effect on the colors so the user can see more clearly under wich color his finger is currently located.
Problems are :
I can't seem to create another popup window on top of this one, Android limitation I think ?
If I modify the current shapeDrawable, resize it, change the boundaries, It needs to re-display the popup window before it takes effect (which is not acceptable of course)
So, anyone knows of a way I could draw over that popup window ?
EDIT :
I've tried solving this issue using a Custom Toast object...But it doesn't quite do the trick. It works, but toast object appears slowly and so the touch motion is not in sync at all with the user movement over the color grid.
I'm not sure if this will help you or not, but you might be able to accomplish this by using a second Activity... this second Activity would use Android's translucent theme if you include the following attribute in your manifest:
<activity android:theme="#android:style/Theme.Translucent">
This second activity will now only contain what you place in your layout. That is... the "real" activity you're running will still be visible behind it (anywhere you don't cover it up with views in the new layout).
You also might prefer Theme.Dialog if you really want to resemble a popup.
Something to keep in mind if you take this approach is you will probably want to override onWindowFocusChanged() in the new activity, and finish() in the event of you losing focus. Additionally, you'll need to figure out how to share your data between the two activities.

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