I've been trying to research this all weekend, but can't find a similar example.
I'm trying to keep a TabPane consistent through out multiple pages. As of right now, once you go past 1 page, the TabPane will no longer be there.
For example:
TabbedPane {
id: root
showTabsOnActionBar: true
Tab {
title: qsTr("Search") + Retranslate.onLocaleOrLanguageChanged
Search {
}
}
}
// Search.qml
NavigationPane {
id: navigationPane
Page {
Button {
onClicked: {
navigationPush.push(pageSearchResults.createObject())
}
}
}
attachObjects: [
ComponentDefinition {
id: pageSearchResults
SearchResults {
}
}
]
}
So basically at this point when we're on the Search page, we have the TabPane.
As soon as I push that Button and navigate to the SearchResults page. The TabPane is gone...
// SearchResults.qml
// We're now 2 pages -IN- from the TabPane
Page {
Button {
onClicked: {
navigationPush.push(nextPage.createObject())
}
}
attachObjects: [
ComponentDefinition {
id: nextPage
NextPage {
}
}
]
}
Also once we're on SearchResults - it won't let me push the next page. When I click the Button on SearchResults, you can see the navigationPush(nextPage.createObject()). It gives the following error:
pushPage : mNavigationStack : ("211") NavigationPane:
NavigationPaneOnFwdTransitionDone: emitting push transition ended for
page: 211 client top: 211
What you need to do is add a navigationPane to the tab and push pages onto that.
A sheet should be opened for something seperate to the tab - e.g. a settings page. Sheets also require buttons or code to close them.
It's not clear from your code whether you are using a navigationPane or not, so here is an example of how it should be working:
TabbedPane {
id: root
showTabsOnActionBar: true
Tab {
title: qsTr("Search") + Retranslate.onLocaleOrLanguageChanged
NavigationPane {
id: navSearch
Page {
}
}
}
}
Now when you want to navigate to the next page in search you will add it to the navSearch navigationPane. This will give you the back button as well.
It would be beneficial to read through the documentation on navigation here: http://developer.blackberry.com/native/documentation/cascades/ui/navigation/index.html
It will explain many details of how the navigation works and how different elements such as tabbed panes and sheets interact.
Related
I have created a scrollable grid view where each icon is supposed to represent a different playlist. I implemented a play button using a navigation link for each playlist in the left corner however, for some reason, the play button is not usable. It does not work in the preview or the simulator. In other words, the play button does not allow me to click it and navigate to another view.
Here is the code I have:
var body: some View {
ZStack {
ScrollView {
LazyVGrid (columns: [GridItem(.fixed(200)), GridItem(.fixed(200))]) {
ForEach(musics) { sub in
ZStack (alignment: .topLeading){
VStack(alignment: .leading) {
Image(sub.albumImage)
.resizable()
.frame(width: 150, height: 150)
.mask(RoundedRectangle(cornerRadius: 20))
Text(sub.albumGen)
.fontWeight(.bold)
.foregroundColor(.white)
Text(sub.songs)
.foregroundColor(.white)
} // END OF VSTACK
NavigationLink {
// Naviagte to a different view!
CategoryView()
} label: {
Image(systemName: "play.circle")
.font(.system(size: 30))
.padding()
}
} // END OF ZSTACK
}// END OF FOR EACH
} // END OF GRID ITEM
} // END OF SCROLL VIEW
} //END OF ZSTACK
}
}
Here is an image of how it looks in the preview and simulator:
I have circled the play buttons because it is hard to see. Usually, when I use a navigation link, the buttons appear blue and are clickable.
How can I edit my code so that the navigation link is active and navigates to a different view?
Embed your View in a NavigationView, which is required for NavigationLink to work.
I am trying to do something very basic, but I have been through the official tutorials, and through dozens of stack overflow posts. I am trying to open an activity from a menu button. I do want the standard navigation back arrow when I do this.
var body: some View {
NavigationView {
VStack(alignment: .leading) {
Text("Hello World!")
.toolbar {
ToolbarItem(placement: .primaryAction) {
Menu {
Button(action: {
Activities()
}) {
Label("Activities", systemImage: "doc")
}
"Activities()" is my view. When I do this nothing happens. I have read in other posts that you cannot have a navigation link in a menu either, which would be fine if that worked. How do I programmatically open up a view so the back arrow works?
Thank you
In this case where you want to open a view but can't use a NavigationLink directly you can use it in another place and activate it programmatically from the button via a State property:
#State private var isShowingDetailView = false
var body: some View {
NavigationView {
VStack(alignment: .leading) {
NavigationLink(destination: Activities(), isActive: $isShowingDetailView) {
EmptyView()
}
Text("Hello World!")
.toolbar {
ToolbarItem(placement: .primaryAction) {
Menu {
Button(action: {
isShowingDetailView = true
}) {
Label("Activities", systemImage: "doc")
}
}
}
}
}
}
I'm trying to add links in my navbar that go to a section of page using Vuetifys scrolling, here's my code:
pageClicked (page) {
this.goToPage(page.path)
this.goToTarget(page, this.options)
},
goToPage (path) {
this.$router.push(path)
},
goToTarget (target, options) {
if (target.topOfPage) {
this.$vuetify.goTo(0, options)
} else if (target.id) {
this.$vuetify.goTo(target.id, options)
}
}
Problem is the scroll fails if I'm not on the same page that where I'm scrolling to is on cause it can't find the target id because it hasn't loaded yet. How can I ensure the page has fully loaded before trying to scroll to the section?
This is a dumb question - but I've been stuck on it for awhile and cannot find an answer.
I'm trying to override the color of an Ext.js checkbox for only certain elements.
CSS:
.x-field-checkbox .x-field-mask::after, .x-field-radio .x-field-mask::after .emptyCell{
color: white;
}
Notice the class there - .emptyCell
Now the Sencha code:
if(noCheckBox) {
var checkbox =
{
xtype: 'checkboxfield',
cls: 'opBuyoffCheckBoxCell emptyColumn',
readOnly: true
};
return checkbox;
} else {
var checkbox =
{
xtype: 'checkboxfield',
cls: 'opBuyoffCheckBoxCell',
listeners: {
change: function (checkbox) {
//Todo put in logic on checkbox change
}
}
};
return checkbox;
}
},
What is the problem here? I have three checkboxes. Two of them should render white and the other one should be normal based on my CSS and logic. I've debugged and it is going into the right code. But when I launch my application it is always using the emptyColumn css class.
Help is appreciated.
Apply this css:
.emptyColumn .x-input-el:checked+.x-field-mask::after {
color: #fff;
}
One thing to notice, write same cls in CSS and HTML.
I am loading content in the magnific popup using the iframe method.
It works just fine, except that it take awhile to load the iframe content. Until the content is loaded the iframe is just a blank dark and empty popup and the user has no clue as to what is happening.
Is there a way to make the iframe show a loading message or animation until the content arrives?
The .mfp-preloader css class is of no help because it is hidden behind the iframe.
I'm thinking the best was is to somehow hide the iframe until it has content.
Thanks
Thanks to Dmitry who pointed me in the right direction, here is the answer that worked for me:
The callback:
callbacks: {
beforeAppend: showIframeLoading
}
The showIframeLoading function:
var showIframeLoading = function() {
var curLength = 0;
var interval = setInterval(function() {
if ($('iframe').length !== curLength) {
curLength = $('.column-header').length;
$('.mfp-content').hide();
$('.mfp-preloader').show();
}
}, 50);
this.content.find('iframe').on('load', function() {
clearInterval(interval);
$('.mfp-content').show();
$('.mfp-preloader').hide();
});
};
You may use popup events to create custom actions, e.g.:
callbacks: {
beforeAppend: function() {
console.log('before iframe is added to DOM');
this.content.find('iframe').on('load', function() {
console.log('iframe loaded');
});
}
}
Instead of polling, how about if we just detect iframe and toggle the mfp-s-ready class from the container.
In case of images, mfp-s-ready is added to the mfp-container div when image has loaded. We can simply toggle that ourself for video (iframe) + use some custom css to our advantage.
callbacks: {
beforeAppend: function () {
if (this.currItem.type === 'iframe') {
$('.mfp-container').removeClass('mfp-s-ready');
}
this.content.find('iframe').on('load', function () {
$('.mfp-container').addClass('mfp-s-ready');
});
}
}
and add this CSS:
.mfp-container .mfp-content {
display: none;
}
.mfp-s-ready.mfp-container .mfp-content {
display: inline-block;
}
This will also support mixmode galleries with videos and images.