I'm trying to layout my flutter application so that it looks like:
-ListView
-WidgetA
-DefaultTabBarController
-Column
-TabBar
-Expanded
-TabBarView
-WidgetB
-WidgetC
So that the whole screen is scollable and that the contents of Widgets A, B, and C can change and the height of the screen is not fixed.
The only way I have been able to get this to work is by doing something like:
-ListView
-WidgetA
-Container (with fixed height)
-Column
-Expanded
-DefaultTabBarController
-Column
-TabBar
-Expanded
-TabBarView
-WidgetB
-WidgetC
But I don't want to have a hardcoded height. Does anyone know how I can achieve this?
I've run into the same problem, I think I'm on the right track using Flexible class instead of Column. https://docs.flutter.io/flutter/widgets/Flexible-class.html I'm also using Slivers https://docs.flutter.io/flutter/widgets/SliverList-class.html with CustomScrollView instead of ListView https://docs.flutter.io/flutter/widgets/CustomScrollView-class.html
Related
im programming a backend system with emberjs and i use the ember select for dropdowns.
the problem that i have is that the list has the same width of the input field.
is their an way to give the list a nother width as the input? In dev tools it looks like that the width is given dynamicly (pic 2)
i didn't found a solution, to change the width dynamicly so it fits to the content in the list
that's how it should look like
Try adding white-space: nowrap; to the items in the list - this will force the text to remain on a single line.
Untested since you haven't posted any code.
I have a tcl/tk tablelist in my application where large number of rows can be represent. I have a scrodget associated with the table so a scrollbar appears when the element count is larger than a current tablesize.
ttk::labelframe .frm -text "Frametitle"
ttk::scrodget .frm.sc -autohide both
tablelist::tablelist .frm.lb -selectmode $selectmode -columntitles $columns
.frm.sc associate .frm.lb
grid .frm.sc -row 0 -column 0 -sticky nsew
grid .frm
Now my problem is for large number of element, my customized periodic update procedure is taking a long time. So instead of all the elements, I only want to update the rows currently visible. Is there any method getting the elements in the current view.
The substitute is implementing some kind of page like feature for the table. But I will think about that as last resort. Please guide.
It's just a matter of combining the right row indices with the index method.
You can get the topmost visible row with:
.frm.lb index top
and the bottom-most visible row with:
.frm.lb index bottom
Hello I am trying to have one scrollbar bind to a text widget and a listbox - is this possible? I want them to synchronously scroll together; basically, the listbox will hold the line numbers of the text widget; like an editor. The code I am trying goes like this:
grid [ttk::frame $f] -column 0 -row 0 -sticky nswe;
grid [tk::listbox $f.num -width 4 -background #EBEBEB -foreground #7AA3CC \
-yscrollcommand "set_scroll $s" -relief flat] -column 0 -row 0 -sticky nswe;
grid [tk::text $n -state normal -wrap word -yscrollcommand "set_scroll $s"] -row 0 -column 1 -sticky nswe;
grid [ttk::scrollbar $s -orient vertical -command {sync_scroll "$f.num $n" yview}] -row 0 -column 2 -sticky nes;
#Sets the scrollbar to the text and listbox widgets
proc set_scroll {scroll_widget args} {
eval [list $scroll_widget set] $args;
eval [$scroll_widget cget -command] [list moveto [lindex [$scroll_widget get] 0]];
return;
}
#Synchronizes their scrolling
proc sync_scroll {widgets args} {
foreach w $widgets {eval [list $w] args}
return;
}
I saw this solution here: How to implement tk scrollbar for multiple listboxes (TCL)?
The problem is it's not working for me exactly. When I click on the scrollbar and drag it to scroll, it only scrolls my text widget; When I use the mouse wheel while my pointer is within the text widget, it still only scrolls the text widget. However, if I scroll with the mouse wheel while the pointer is over the listbox, both widgets scroll synchronously as they are supposed to. What's going on?
1: Did I do something wrong in my code?
2: Is this supposed to work with two different types of widgets like I am trying to do?
3: This above code, as mentioned in that linked post, works for Tk 8.4; I'm using tcl/tk 8.6. Would there be any issues for me regarding that version disparity?
4: Is this the best way to achieve what I am trying to do? My goal is to get the same effect as text editors like notepad++ or any IDE; with a section to the left keeping track of line numbers. This is working so far, but I'm not having a good time with these multi-scrolling issues.
The first obvious problem is that you do: {sync_scroll "$f.num $n" yview} when you'd be better using [list sync_scroll [list $f.num $n] yview]. The second obvious problem is:
foreach w $widgets {eval [list $w] args}
As the author of the question you took the code from (;-) I can say for sure that args refers to a variable which you want to read. Tcl's always explicit about that sort of thing; it really differentiates between mention and use of variables and commands. The code should be:
foreach w $widgets {$w {*}$args}
You're using 8.6, so you can use significantly less tricky idioms than eval! (This is basically the code from the top half of my prior answer.)
Yes. It should work with two different widgets as long as you're scrolling in the same direction. I suppose you could hack it to scroll one widget horizontally in sync with another vertically, but why would you do that!?
Tk 8.6 is pretty similar to 8.5 in a very large number of respects, and not really all that hugely different to 8.4. (My tip of the day: the less effort you put into squeezing every little bit of customizability out widgets, the easier the version upgrades are. Tk has genuinely sensible defaults.) The main differences (8.4->8.5) that you're likely to notice are:
More widgets (the ones in the ttk namespace).
Text widget scrolling was completely redone. Hopefully you won't have any problems from this.
The main changes to 8.6 shouldn't affect what you're doing. (Native PNG support, rotated text on the canvas, stuff like that.) The script-visible changes from 8.5 to 8.6 in Tk are really quite small.
Consider using a ctext widget from Tklib. It's a megawidget — scripted widget — that has a number of capabilities defined for you. In particular, you can turn on the -linemap option to get a listing of line numbers on the left of the widget (I think it might be switched on my default, FWIW).
I'm working with PyQt and I was wondering if there is any way to set a grid layout in a window so that, for example, one button's geometry wouldn't be affected by the configuration of the layout - because I'm trying to have my button in a square shape and, with the grid layout, it always becomes a long rectangle.
Also, I have multiple rows and columns, and to edit each minimum size would be horrifying. So, is there is any way to establish the geometry of a widget in a grid layout?
UPDATE: my grid
self.Grid = QtGui.QGridLayout()
self.Grid.addWidget(self.Button1,0,0)
self.Grid.addWidget(self.Box1,2,1)
self.Grid.addWidget(self.Box2,2,3)
self.Grid.addWidget(self.Button2,0,4,Qt.AlignRight)
self.Grid.setRowMinimumHeight(1,50)
self.Grid.setRowMinimumHeight(1,50)
self.Grid.setRowMinimumHeight(3,250)
self.Grid.setColumnMinimumWidth(0,100)
self.Grid.setColumnMinimumWidth(2,50)
self.Grid.setColumnMinimumWidth(4,100)
self.setLayout(self.Grid)
Given the example code in your question, just add something like the following:
self.Button1.setMinimumSize(50, 50)
self.Button1.setMaximumSize(50, 50)
or:
self.Button1.setFixedSize(50, 50)
I'm attempting to customize a vbulletin theme further then my experience allows me to (I really enjoy web development so I'd like to really go out of the box and attempt to learn something with this one)
My issue is, when I try to arrange the forum sections into a side-by-by block, they get disoriented and misplaced... With vbulletin, its difficult to pin-point what exactly is causing certain issues even with firebug.
Essentially, this is what I am looking to get
[Forum 1] [Forum 2]
[Forum 3] [Forum 4]
[Forum 5]
and so on.. I was able to throw this together using just regular uls/lis and divs... but when I get to something dynamic where you actually need to pull the data from somewhere, it gets confusing for me.
Here is what it looks like currently, http://www.eldersreach.com/forum.php?styleid=90
You may need to head down to the bottom left and change the theme to "ESOLight" that is where the issue resides
Set the width to each element to 50% and set the "float" property to "left".
CSS
div.forum {
width:50%;
float:left;
}
Note that if you have borders or padding, etc, you will need to adjust the width property respectively to your other style attributes.