Search results for

“column”

2,085 results found

Post

Replies

Boosts

Views

Activity

Reply to Getting NSBrowser+NSTreeController to recognize its delegate
I slept on the problem and managed to find a workaround, although it's not a complete one.If I implement the delegate method -browser:numberOfRowsInColumn:, NSBrowser recognizes my object as an old-style delegate and will send all of the optional delegate methods. However, as I mentioned, this also severly limits the usability of NSBrowser because now calls to -itemAtRow:inColumn: and similar methods throw an exception that they are not supported.My solution (and by solution I mean hack) is to subclass NSBrowser and implement my own -itemAtRow:inColumn: method, like this:- (id)itemAtRow:(NSInteger)row inColumn:(NSInteger)column { NSMatrix* columnMatrix = [self matrixInColumn:column]; NSCell* cell = [columnMatrix cellAtRow:row column:0]; return cell.objectValue; }Since all of the cells in the NSMatrix are bound to the objects in the NSTreeController, the item of any given [row,column] is a well-known value. (Why NSBrowser can't do this is beyond me.)It doesn't solve the problem of -p
Topic: UI Frameworks SubTopic: AppKit Tags:
Jun ’15
Reply to Find which button is pressed in a Grid in SwiftUI
Oh I see. That's unfortunate but I can work around it by comparing the title property values. Thanks a ton for all your help. btw I changed the ObservableObjects to use generics. It doesn't seem to have an effect on functionality-wise. Everything works ok. However (this issue actually persisted before changing it to generics too), the SwiftUI preview for this view doesn't get rendered. swift class MenuViewObservableT: MenuItem: ObservableObject { var onButtonTap: ((MenuItem) - Void) = { _ in } } struct UserTypeMenuView: View { @ObservedObject var observable: MenuViewObservableMenu.UserType private let columns = [ GridItem(.flexible(), spacing: 20), GridItem(.flexible(), spacing: 20) ] var body: some View { ScrollView { LazyVGrid(columns: columns, spacing: 20) { ForEach(Menu.UserType.allCases, id: .self) { item in MenuButtonMenu.UserType(item: item, action: observable.onButtonTap) } } .padding(.horizontal) .padding([.top, .bottom], 20) } } } struct UserTypeMenuView_Previews: PreviewP
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’21
Reply to Instruments: what is static AppName.$main() [inlined]
I see I forgot to enable email notifications of replies... fixed. I'm using a Swift table with 4 columns. In testing I replaced the columns with a fixed Text view to see if that was an issue. It wasn't. There was in issue in row: closure to the table in that the array consisted of large-ish structs and a lot of time was being taken allocating and freeing memory to copy the array entries. I changed the struct to a class and saved about 40% of the delay time. Still, there is something going on. When I select an item in the table the user experience is 1) the row turns blue, 2) longish delay, 3) text in the first column changes color. Normally lots of other stuff goes on but I disabled all of it looking for the source of the longish delay. That delay is the hang reported above. If I show system libraries it looks like this: Note that I also scrolled the tracks to show View Body and the Core Animation Commits -- fwiw I am not doing any additional animation over whatever is built into Sw
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’23
Reply to macOS SwiftUI Table with contextMenu
but then I will have to add it to each individual column If you need to repeat the same functionality for the context menu, put that in function and make the Button action call that same function. Probably obvious to many. But seems to be the only work around if you want the context menu for the row to be consistent. I too want a single context menu definition for a Table row. In UIKit you have to select the defined cell to reveal the context menu, clicking on places which are effectively empty space doesn't open the context menu. The trick here is to expand your cell to fit the column width. Out of the box Table { }.contextMenu{ } doesn't seem to work at all. I've attached the modifier to the Table and see no context menus at all. So it seems we are stuck with attaching the context menu to the contents of the TableColumn and each column if you want it appear across the row. It forces you to define the content closure, you can't use the TableColumn defaults. Still feels like being a
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22
Reply to unused variable check -> turn back on
In the Build setting, I searched for unused. I saw the setting (3 columns in project, 4 in Targets)Resolve, myApp (in target only), myApp and iOS DefaultI wanted the alerts , so I set all to Yes except for the last column which is set to No and that I cannot change.That was my ScreenShot.the reading your answer, I realized that I was checking if it was working with Instance Var and it was not working but I just check inside a func and it work.I guess it must be the normal behaviour for instance var to not give the alert.Thank you Claude31, I think it's not the first time you help me !
Jan ’19
Reply to how to input user data from a tableview
I'm not sure I made my problem clearWhile I set the values in the table using the tableView method I'm allowing the user to change the values in the tableview by making the cells in the second column editable.I want to know how to retrieve the new values the user has entered from the table.I notice there are two versions of the tableView function. the first is called by the tableview to populate the cells.I'm unclear as to how/when the second version of the function is called:func tableView(tableView: NSTableView, setObjectValue object: AnyObject?, forTableColumn tableColumn: NSTableColumn?, row: Int) { an example of how to get the value for row n, column i of a tableview would be appreciated.Thanks for your help!
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’16
Reply to NavigationSplitView No Toggle Button
Why is there no toggle button above? What do you mean by toggle button? Do you mean the button that hides and shows the sidebar? This is only present when the horizontalSizeClass is .regular. On an iPhone in portrait mode, it won't appear. ‎ And why is the menu always showing? What menu are you talking about? ‎ I cant see the detiail view anymore If you want to see the detail view, you need to select an item from the list. As I said before, the two-column layout with the sidebar toggle button is only present when the horizontalSizeClass is .regular. In your screenshot (an iPhone in portrait mode) the NavigationSplitView collapses down to a single column layout and acts more like a NavigationStack.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’22
Reply to Print something on the screen
I'm trying to do it in Swift Playgrounds and here's my code: import PlaygroundSupport let columns: [GridItem] = [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())] struct ContentView: View { var body: some View { GeometryReader { geometry in VStack { Spacer(minLength: 290) Text(text) .font(.largeTitle) ZStack { LazyVGrid(columns: columns) { Group { Button { } label: { ZStack { Circle() .frame(width: 90, height: 90) .foregroundColor(Color(.systemBlue)) .opacity(0.5) //.position(x: geometry.size.width/2, y: -100) Text(5) .font(.largeTitle) .bold() .foregroundColor(.black) } .frame(width: 90, height: 90) } } } } } } } } PlaygroundPage.current.setLiveView(ContentView()) I've created a text and I would like that the text will change on the press of the button. For example: there's a Text() witch now has written on it text and when I press the blue button (you can see it in my code), I want text to change to number 5
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’22
Reply to Plist max size
Replied yesterday, but it still on moderation because of link to picture with table example.So yes, all tables is rectangular, and each row have the same number of columns, and vice versa, yes.
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’17
Reply to Getting NSBrowser+NSTreeController to recognize its delegate
I slept on the problem and managed to find a workaround, although it's not a complete one.If I implement the delegate method -browser:numberOfRowsInColumn:, NSBrowser recognizes my object as an old-style delegate and will send all of the optional delegate methods. However, as I mentioned, this also severly limits the usability of NSBrowser because now calls to -itemAtRow:inColumn: and similar methods throw an exception that they are not supported.My solution (and by solution I mean hack) is to subclass NSBrowser and implement my own -itemAtRow:inColumn: method, like this:- (id)itemAtRow:(NSInteger)row inColumn:(NSInteger)column { NSMatrix* columnMatrix = [self matrixInColumn:column]; NSCell* cell = [columnMatrix cellAtRow:row column:0]; return cell.objectValue; }Since all of the cells in the NSMatrix are bound to the objects in the NSTreeController, the item of any given [row,column] is a well-known value. (Why NSBrowser can't do this is beyond me.)It doesn't solve the problem of -p
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jun ’15
Reply to Find which button is pressed in a Grid in SwiftUI
Oh I see. That's unfortunate but I can work around it by comparing the title property values. Thanks a ton for all your help. btw I changed the ObservableObjects to use generics. It doesn't seem to have an effect on functionality-wise. Everything works ok. However (this issue actually persisted before changing it to generics too), the SwiftUI preview for this view doesn't get rendered. swift class MenuViewObservableT: MenuItem: ObservableObject { var onButtonTap: ((MenuItem) - Void) = { _ in } } struct UserTypeMenuView: View { @ObservedObject var observable: MenuViewObservableMenu.UserType private let columns = [ GridItem(.flexible(), spacing: 20), GridItem(.flexible(), spacing: 20) ] var body: some View { ScrollView { LazyVGrid(columns: columns, spacing: 20) { ForEach(Menu.UserType.allCases, id: .self) { item in MenuButtonMenu.UserType(item: item, action: observable.onButtonTap) } } .padding(.horizontal) .padding([.top, .bottom], 20) } } } struct UserTypeMenuView_Previews: PreviewP
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’21
Reply to Instruments: what is static AppName.$main() [inlined]
I see I forgot to enable email notifications of replies... fixed. I'm using a Swift table with 4 columns. In testing I replaced the columns with a fixed Text view to see if that was an issue. It wasn't. There was in issue in row: closure to the table in that the array consisted of large-ish structs and a lot of time was being taken allocating and freeing memory to copy the array entries. I changed the struct to a class and saved about 40% of the delay time. Still, there is something going on. When I select an item in the table the user experience is 1) the row turns blue, 2) longish delay, 3) text in the first column changes color. Normally lots of other stuff goes on but I disabled all of it looking for the source of the longish delay. That delay is the hang reported above. If I show system libraries it looks like this: Note that I also scrolled the tracks to show View Body and the Core Animation Commits -- fwiw I am not doing any additional animation over whatever is built into Sw
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to macOS SwiftUI Table with contextMenu
but then I will have to add it to each individual column If you need to repeat the same functionality for the context menu, put that in function and make the Button action call that same function. Probably obvious to many. But seems to be the only work around if you want the context menu for the row to be consistent. I too want a single context menu definition for a Table row. In UIKit you have to select the defined cell to reveal the context menu, clicking on places which are effectively empty space doesn't open the context menu. The trick here is to expand your cell to fit the column width. Out of the box Table { }.contextMenu{ } doesn't seem to work at all. I've attached the modifier to the Table and see no context menus at all. So it seems we are stuck with attaching the context menu to the contents of the TableColumn and each column if you want it appear across the row. It forces you to define the content closure, you can't use the TableColumn defaults. Still feels like being a
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to unused variable check -> turn back on
In the Build setting, I searched for unused. I saw the setting (3 columns in project, 4 in Targets)Resolve, myApp (in target only), myApp and iOS DefaultI wanted the alerts , so I set all to Yes except for the last column which is set to No and that I cannot change.That was my ScreenShot.the reading your answer, I realized that I was checking if it was working with Instance Var and it was not working but I just check inside a func and it work.I guess it must be the normal behaviour for instance var to not give the alert.Thank you Claude31, I think it's not the first time you help me !
Replies
Boosts
Views
Activity
Jan ’19
Reply to Unable to click *some* folders in Finder
I'm having the exact same issue but it seems to be confined to list and column views. I can't click the fourth item from the top whether it's a file or folder. Quite bizarre.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’16
Reply to Collection View not showing up
IB. but i also have 6 cells, each with a different image in it. its showing 6 cells in 2 columns, exactly like i want it to, but its all the same cell, just repeated, and very small
Replies
Boosts
Views
Activity
Jul ’19
Reply to In Xcode 12, In Info.plist file column expanding or resizing to zoom not working
What doesn't work ? I have opened A projet Targets, selected Info. I could resize the Key column at will. Not the Type nor Value. Can you describe exactly the problem (SO capture is not very explicit of the problem).
Replies
Boosts
Views
Activity
Oct ’20
Reply to how to input user data from a tableview
I'm not sure I made my problem clearWhile I set the values in the table using the tableView method I'm allowing the user to change the values in the tableview by making the cells in the second column editable.I want to know how to retrieve the new values the user has entered from the table.I notice there are two versions of the tableView function. the first is called by the tableview to populate the cells.I'm unclear as to how/when the second version of the function is called:func tableView(tableView: NSTableView, setObjectValue object: AnyObject?, forTableColumn tableColumn: NSTableColumn?, row: Int) { an example of how to get the value for row n, column i of a tableview would be appreciated.Thanks for your help!
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’16
Reply to NavigationSplitView No Toggle Button
Why is there no toggle button above? What do you mean by toggle button? Do you mean the button that hides and shows the sidebar? This is only present when the horizontalSizeClass is .regular. On an iPhone in portrait mode, it won't appear. ‎ And why is the menu always showing? What menu are you talking about? ‎ I cant see the detiail view anymore If you want to see the detail view, you need to select an item from the list. As I said before, the two-column layout with the sidebar toggle button is only present when the horizontalSizeClass is .regular. In your screenshot (an iPhone in portrait mode) the NavigationSplitView collapses down to a single column layout and acts more like a NavigationStack.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to Print something on the screen
I'm trying to do it in Swift Playgrounds and here's my code: import PlaygroundSupport let columns: [GridItem] = [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())] struct ContentView: View { var body: some View { GeometryReader { geometry in VStack { Spacer(minLength: 290) Text(text) .font(.largeTitle) ZStack { LazyVGrid(columns: columns) { Group { Button { } label: { ZStack { Circle() .frame(width: 90, height: 90) .foregroundColor(Color(.systemBlue)) .opacity(0.5) //.position(x: geometry.size.width/2, y: -100) Text(5) .font(.largeTitle) .bold() .foregroundColor(.black) } .frame(width: 90, height: 90) } } } } } } } } PlaygroundPage.current.setLiveView(ContentView()) I've created a text and I would like that the text will change on the press of the button. For example: there's a Text() witch now has written on it text and when I press the blue button (you can see it in my code), I want text to change to number 5
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’22
Reply to Plist max size
Replied yesterday, but it still on moderation because of link to picture with table example.So yes, all tables is rectangular, and each row have the same number of columns, and vice versa, yes.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Feb ’17
Reply to This class is not key value coding-compliant error
On which line does the crash occur ? Just to be sure: the column identifier is for the NSTableColumn object, not NSTableCellView ? Have you check it is exactly itemUsed, including capitalisation ? Could you show also how and where you call createItem()
Replies
Boosts
Views
Activity
Nov ’20
Reply to LayoutConstraints error from NavigationView with navigationTitle
Xcode 13.4.1 and using the .navigationViewStyle(.stack) hung off the NavigationView {} works without tossing errors. Automatic tosses errors and Columns is iOS 15 only(did not try).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How to declare a TableColumn with nullable field?
Your decoding process will need a way to represent nil values probably in the form of values so the table column can bind to the table row while reading from the items provider if you're reading from one.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21