Declare bottom zone in a SwiftUI navigation sidebar below a list - swiftui

In the below screenshots (taken from the Apple Developer app), we can see that the Account button sticks to the bottom of the sidebar.
When the window is tall enough (left), the list doesn’t scroll, Account button’s background color has no difference. When the window is not tall enough (right), causing the list to scroll, Account button changes its background color to reveal the relationship.
The list's scroll position can not be probed. How can I declare the Account button in SwiftUI?

That app is a UIKit catalyst app and the sidebar uses scrollViewDidScroll which uses the contentSize to set a bottomButtonState which is passed into a child UIHostingController (so the account button can be SwiftUI) which I would assume switches between a clear or solid background.
We cant get the scroll info in SwiftUI however a possible workaround would be to add dummy 1 pixel high cell to the bottom of the list and using its onAppear to set a binding that is used in a bottom view to enable/disable a background colour and should achieve the same effect.

Related

Why does a swipe gesture stop advancing paged view controller after opening and closing side menu?

My app, written in SwiftUI 2.0, is based on a UIPageViewController which displays four panels, in the common onboarding style. The user can swipe through them, or advance them using an arrow button at the bottom.
I also have a button in the upper left that opens a slide out menu, which can be closed by with a tap gesture anywhere on the interface. This is driven by changing the geometry in the swiftui "Geometry Reader", in which the page controller is embedded.
All this works correctly, except when the user closes the side window, the swipe gestures fail to activate the transition between pages. The active page slides with the swipe, but then snaps back into place. However, the arrow button still advances the UIPageViewController to the appropriate next page.
What causes the swipe gesture to become inactive after this slide out is triggered?
I've posted a small sample app isolating the issue here: https://github.com/stevepvc/Slide-and-Swipe-Concept. The code controlling the slide out menu is in "Top Content View".

SwiftUI fullscreen horizontal swipe with dot indicator

Many apps have an intro view that has fullscreen pages with a dot indicator at the bottom. Sometimes it is used to gather same basic information, sometimes to introduce the app features.
How can I realize that?
I tried the ScrollView with a horizontal setting. The issue is to set up the content to fit the screen and have the edges snap on scroll. Second issue is the have a dotted indicator that highlights the current page.
you need to wrap UIPageControl with UIViewControllerRepresentable.

swipe handled by ember-gestures, but also scrolls

I've creates a "touch-list" component for EmberJS, based on ember-collection, with ember-gestures mixed in:
import RecognizerMixin from 'ember-gestures/mixins/recognizers';
export default Ember.Component.extend(RecognizerMixin, {
recognizers: 'tap press swipe',
...
swipeLeft(event) {
...
event.preventDefault();
event.stopPropagation();
},
...
My test app has two panels, one for the list and the other for item details. (Slighly out-of-date source code is on GitHub.) On a screen 640px or wider, the container for the panels is set to the viewport width, and all is well - horizontal swipes are recognized, and don't trigger scrolling.
On a screen 639px or narrower, I set the container to twice the viewport width, and each panel to the viewport width. Horizontal swipes on the list header or detail panel scroll, as expected.
The problem is horizontal swipes on list items on touchscreen devices. They are recognized as gestures, and handled by list items, but they also cause horizontal scrolling! As seen above, I call event.preventDefault(); and event.stopPropagation(); but that doesn't help.
How can I prevent swipes from causing horizontal scrolling?
My solution was to change the layout so horizontal scrolling never happens. Now, the horizontal movement of the panels is implemented using transform: translateX(-100%);
I have thusly advanced to a new level of confusion:
How do I set a class on a parent element when a route is the first one loaded?

Layout with invisible button steals click events from underlying button in Qt5 form (QtCreator)

I have designed a form in QtCreator for Qt5 where I have a row of buttons without layout (Blueberry+, Peach, Lemon, Mango and Water in screenshot below) with a grid layout on top.
The grid layout has one button (Register Now), one label(HELLO JOHN) and two horizontal spacers inside:
In the code, the label and button in the layout are set to visible=false.
When I start the program and show the screen I only see the underlying row of buttons, but I can't click them. The layout seems to somehow steal the focus. I can verify this by moving the layout in the editor to see the boundary for where my clicks work following it.
Other than this there isn't much going on in the gui, so I am kind of stumped as to why a QGridLayout steals my clicks.
Any tips on how I can avoid this?
You should hide the QGridLayout itself and not the button and label.
You are done here if the button and label hides and shows togather.
if not. along with showing and hidding the grid. show and hide the label and button.
Does that seems to solve the problem?

scrollbars of a CScrollView in a CDockablePane are disabled

I've designed a toolbox control. It's inside a CDockablePane object. Since the tools inside it may need to be scrolled, I've created a CScrollView as a child of the pane and have inserted the tools inside it as children. Based on the pane size, scrollbars of the CScrollView object appear properly, but clicking on them doesn't scroll the view. It seems that they're disabled. When I use SS_NOTIFY style when creating the CScrollView, the CScrollView object receives mouse clicks, but when i don't use the style, it doesn't. But it seems that the scroll bars inside the view control don't receive clicks. When mouse hover over them, no visual effect in scroll bars appears. It seems that the scroll bars are disabled, while I've not created nor manipulate them.
What's wrong?
mouse wheel works. click on scrollbars is received by the scroll view, not by the scrollbars. inside handler, i wrote this code:
CScrollBar *pScroll = GetScrollBarCtrl(SB_VERT);
if (pScroll->GetSafeHwnd())
{
...
if is not true. this means that the scroll view has not a scroll bar, but if so, how is it shown?!
any idea?
...
since i didn't get answer, i'm going to clarify my question with a sample code:
https://dl.dropboxusercontent.com/u/4829119/930501%20-%20t3.zip
in this sample, how can i scroll my view as i do with other views like class view and file view?
the sample code screenshot:
https://www.dropbox.com/s/7pu5chpyj9hqeal/Screenshot%202014-07-23%2003.40.26.png
Did you initialize by calling SetScrollSizes? The scroll bars are enabled only when the sizeTotal is larger than the view window size.