Indeterminate Slider being dismissed - google-glass

Currently implementing the last example at
https://developers.google.com/glass/develop/gdk/slider
but with only one card (loading card)
problem is that if I scroll (swipe forward or backward) the slider gets dismissed
How do I keep the slider from getting dismissed?

The Slider is a global component that gets overwritten when another client requests it, in this case, the CardScrollView.
One way to solve this would be for you to CardScrollView's scroll bar in your onCreate() method with:
mCardScrollView.setHorizontalScrollBarEnabled(false);

Related

Qt MouseMoveEvent only triggers with a mouse button press

I have an odd problem here.
I'm working on an application, and within one of my classes I'm monitoring my mouse events.
The weird thing is, my mouse move event will only get called if any mouse button is pressed.
I'm not even filtering for any button presses within the method; the method itself doesn't even get called unless I click on this object itself (the one that's monitoring it).
What generally causes this type of error to happen?
I'm not sure if it's relevant, but I have 2 different things monitoring my mouse inputs: 1) the main program monitoring the global mouse coordinates, and 2) an object within my program monitoring the mouse coordinates within itself.
Edit
So the problem has to be because mouse move event is generally used when people are dragging the cursor along the screen right?
My reason for not needing it like that is because I'm building a custom context menu of sorts, and I need to know when an item is hovered over.
It turns out that I didn't truly set everything within my class to enable mouse tracking.
I somehow thought if the class itself was set to have it enabled, I wouldn't need to set it to all the sub objects, but now I see how that wouldn't make any sense at all.
So just to clarify my solution:
The items that I needed to track my cursor's position needed to have
setMouseTracking(true);

MFC Print Preview 'Prev' button not enabling when used with Objective Grid from Rogue Wave - Stingray Studio

I have an MFC app that uses Rogue Wave's Stingray Studio Objective Grid to display a dialog with a grid in it. When doing a print preview, the grid uses the MFC print preview mechanism to generate the print preview dialog. On the dialog I see all the buttons you would expect, including next and previous, and zoom in and zoom out. I have more than one page worth of data in the grid and so I see a scroll bar on the right, the Next button is enabled and the previous button is disabled. If I click on the next button, the dialog advances the preview to the next page of the data, and I see the scroll bar move down accordingly, but the Prev button does not become enabled. I can use the scroll bar to scroll in both directions, but the 'Prev' button never becomes enabled and the Next button never disables when I reach the last page. I see a similar problem with the Zoom buttons. I can zoom in, but the zoom out button never enables so I can never zoom out anymore.
Has anyone seen this sort of behaviour before and know what causes it?
So it would seem that my problem boils down to the toolbar not getting messages to refresh itself. It should be getting a WM_IDLEUPDATECMDUI whenever the preview invalidates itself, but it is not. A sample app I found is working correctly and it does get those messages. What I believe is happening in my situation is that My code is in a DLL for an app which I do not control, and when the app catches messages, it swallows certain ones, including this one. I was able to resolve the issue with a kludge. I find the preview window and in the OnPrint virtual function I send the message to it's toolbar. This works quite well, but it is not very pretty.

How to scroll multiple QGraphicsView when scrolling one of them (no scrollbars)

I have three QGraphicsView s each one with a different scene.
I am trying to scroll all the views when the user is scrolling one of them.
The scrolling is carried out by the user dragging in the QGraphicsView widget which calls QGraphicsView::scrollContentsBy. (no scrollbars)
My first implementation:
From scrollContentsBy I am calling centerOn for all the other views but this ends up into a recursive call of scrollContentsBy.
My second implementation:
From scrollContentsBy I am calling scroll for all the other views but the view is not updated correctly (missing part of the scene). It does scroll correctly though.
I tried different versions on this but I can't find the solution.
Any idea would be great.
Edit:
I found the answer but I need to wait 3 more hours before to reply to my own question :)
I am glad that in fact I can answer my own question and share the answer with others.
The only thing that you have to do, it is to create 2 scrollbars (one vertical and one horizontal) and to set these two scrollbars for all the QGraphicsView instances. When the user drag one picture all the view receive the same event and scrollContentsBy is called for each view.
Easy when you know.
m_hScrollBar = new QScrollBar(Qt::Horizontal);
m_vScrollBar = new QScrollBar(Qt::Vertical);
m_srcView->setHorizontalScrollBar(m_hScrollBar);
m_srcView->setVerticalScrollBar(m_vScrollBar);
m_dstView->setHorizontalScrollBar(m_hScrollBar);
m_dstView->setVerticalScrollBar(m_vScrollBar);
m_diffView->setHorizontalScrollBar(m_hScrollBar);
m_diffView->setVerticalScrollBar(m_vScrollBar);

MFC add scrollbar to CWnd member

I have a member of CWnd class name mywindow
and i want to add to it a scroll-bar.
how i can do it?
i try already to do:
mywindow.EnableScrollBarCtrl(SB_BOTH,TRUE);
it display both Horizontal and Vertical scroll-bars,
but i cannot push the buttons or move the scroll-bars.
i try also after the first command:
mywindow.EnableScrollBar(SB_BOTH,ESB_ENABLE_BOTH);
and it change nothing.
can someone could show me a simple example how to add scroll-bar to this member?
thanks a lot,
Tal
Enabling the scroll bars isn't enough. You have to react to the window messages WM_HSCROLLand WM_VSCROLL. Using the GetScrollInfo method you get the position (value) of the scroll bars and then you draw your window content according to this position.
Look up some scroll bar tutorials such as http://www.codeproject.com/KB/dialog/scrolling_support.aspx . In essence, dwo's comment above is what you need to do - handle those messages and set the virtual client area size.
There must be some 'overflow' before scroll bars became active.
Write some 'sufficiently long' data in your view and the scrollbars will become active (at least, that was my experience time ago).
Usually scroll bars get handled 'automatically' from MFC components like (for instance) text editor or form view. I.e. will became visible when needed also without explicit call EnableScrollBarCtrl ...

progress bar in nokia Qt?

I'm using progress bar in my app. when i navigating first widget to second widget and in-between i'm using progress bar in another widget.
//code:
progressform *pgm = new progressform(); // calling progress bar widget
pgm->adjustSize();
pgm->show();
for(int i=24;i<=100;i++) //initial setvalue is 24
{
pgm->ui->progressBar->setValue(i);
}
detailWidget *dwt = new detailWidget(); // calling detail widget
dwt->show();
Before going to detailwidget i called progressform(widget) and after that the progressbar setvalue reach 100 it moves to detailwidget. the problem is i cant resize the progress widget in to center of the screen like popup screen and I want to sleep time because i want to see the progress value increased one by one?
Thanks in advance
I can recommend using QProgressDialog instead which pops up centered automatically.
You'll have to center your progress bar manually. Popup screens do so automatically, but progress bars normally are used as part of a dialog. Therefore they are positioned by the dialog layout.
As for the sleeping, that's probably a design error. If your task is so fast you'd need a sleep just to see the progress bar, you shouldn't have a progress bar in the first place.