I have created a 100×100 table by default only 20×20 cell of table is shown, also I have an editfeild component when user input :goto AA20 or other select cells the view of table will change and will show that cell and cells around it
Like this:
When i write goto AA20 in edit field it should show this view
I need help to write this .
Best regards*
I have created my own method which get called while pressing Ctrl + C to copy selected row and paste there. But above this tableviewer's composite , i have another composite where I have text box.
Problem : if i try to copy text which is in textbox , it doesn't copy and hence it won't be pasted as I have used method activateHandler where I have written my own logic to copy table row.
I want to make it limited to particular table composite and can use default copy and paste in TextBox Composite.
I have a subform bugging me. The mainform contains buttons etc. Everytime the user close/open the form, the columns width is reset to whatever the table likes. If i open the table directly, the size is as i want. If i change it in the subform, it is not saved. (See screendump)
I would like "Phase" to stay about 2 cm width. I can enter the subform and edit the "Width" but that is only applied to the other views.
I hope you can help, Emil.
I realize this post is almost 2 years old, but I ran into the same problem and came across this post.
I am running MS Access 2013 on Windows 7 Ultimate. I did not find the solutions offered here to work for me, so, I set out to find something that would work for me before I went to VBA code. (Incidentally, I appreciate the link offered by #Patrick_Honorez in his comment on the original post because that was going to be my fall-back solution.)
Anyway, here is what worked for me and I hope perhaps it will work for others as well:
Open the parent form.
In the subform, right-click the column header
for the column for which you wish to adjust the width.
Select the “Field Width” item from the context menu.
In the “Column Width” dialog that appears in step 3, enter the desired column width in points, or, use the [Best Fit] button. Then click the [OK] button to close the dialog and return to the form.
Right-click the parent form’s border to bring up the parent form’s context menu. Click the “Save” item in the context menu.
Now close the parent form.
The next time the form is loaded, the column widths should be as set it step 4 above--at least they are for my setup.
I see this post is quite old and OP must have figured someway to tackle the issue. I came across same issue today and found solution on this link.
For anybody else having same issue, use following code (I modified the code a little because original code from the above mentioned post saves column width of only text boxes but my form has combo boxes too, column width of which was not getting saved) in close and open events of your subform and then open main form in Form View and then manually select desired widths either by mouse, by entering column width value or using best fit. Save the form and reopen to check results. That's it.
Private Sub Form_Close()
Dim ctrl As Control
For Each ctrl In Me.Controls
If (ctrl.ControlType = acTextBox Or ctrl.ControlType = acComboBox) Then
SaveSetting "propertiesDBS", Me.Name, ctrl.Name, ctrl.ColumnWidth
End If
Next
End Sub
Private Sub Form_Open(Cancel As Integer)
Dim ctrl As Control
Dim frm As Form
Dim w As Long
For Each ctrl In Me.Controls
If (ctrl.ControlType = acTextBox Or ctrl.ControlType = acComboBox) Then
w = GetSetting("propertiesDBS", Me.Name, ctrl.Name, 0)
If w <> 0 Then ctrl.ColumnWidth = w
End If
Next
End Sub
I know this is late to the party and most likely going to be the last comment anyone reads, but this can be done quite simply in MS Access 2016 - by someone like myself who has no more than 4 days experience in databasing overall and no experience with writing custom Macro's or VB Script (using only what is native to MS Access).
Here's how I did it.
Scenario - Split Form (Form + Datasheet).
Extra Recommendations:
It pays to be across all properties of every object type in your database, as a change in a field property can cause unpredictable erratic effects, which take ages to figure out why it happened and how to stop it from happening again, whilst delivering your desired outcome.
Me.Requery in your VBA script after every necessary event and also in your main form (generally the 'After Update' event is used most), and be wary that too many Me.Requery's (in unnecessary events) can also be detrimental - so too much of a good thing can be a bad thing.
Bottom Line Up Front - Modify the format of your query that is to be exported/printed.
In 'Design View' of the query you are concerned with, ensure that the fields are in the order you need them outputted in first as this is exactly how the macro will present them for export/print (example could be "Australia" then "Northern Territory" then "Town's In The Northern Half Of The State" then "Darwin" then "Suburbs In The Northern Half Of City").
Switch to 'DataSheet View' in the same query and use the top left folded over triangle looking thingy to highlight the entire data set then right click that same triangle to present an options menu. Select 'Row Height' and type in "15" (default row height in Excel).
Deselect the entire spreadsheet and this time select every column (left click the left most column, hold shift button, scroll over to the right to the far end of the data set and click the last column) and then right click one of the highlighted columns to present another menu. Select 'Field Width' and within that new pop-up menu select 'Best Fit' and then 'OK'.
(Optional - not sure if this helps or hinders but I did it for my purpose) With the columns still selected right click one of the highlighted columns again and select 'Freeze Fields'.
My scenario had buttons with macros configured to run filtered reports so I was able to check this by simply clicking any of those buttons and seeing the report formatting, which it held true to the work I had just done. I exported using another button with a macro that exports to Excel with 'Print Formatting' selected (my main form also had the datasheet view as the only thing that could be printed and was also set in 'Print' formatting.
The Excel spreadsheet opened with all row heights and column widths in a way that I could read every field/record with perfect ease and without extra modification.
This also worked for cascaded combo boxes, with the export only outputting the 'drilled down/filtered' datasheet records, in a format that required no further modifications.
Hope this helps someone, as its saved my hide! :)
Open the Main form in Design. Go to the SubForm. Click on the square at the top left of the SubForm and select 'Properties'. Right-Click the control 'Phase' and click 'Properties'.Click the 'Format' tab and select 'Width'. What do you see there? That should control the widht of control 'Phase' unless you have some overriding coding elsewhere. Input the size you want and see what happens.
Use continuous forms instead. It gives you complete control over how your subform displays.
If you open your subform directly, your property sheet menu should display automatically if the default view is "Datasheet." Click on "All" and change the "Auto Resize" property to "No." This should solve the issue and avoid the need for VBA.
This only works when you open the subform separately. So if you want the changes to be reflected within your main form, you'll have to close it and switch back and forth.
Super annoying by default.
It seems to work as one would expect of you set the view mode to layout view. Drag column widths as needed and save. Go back to form view and it works. It's really dumb it doesn't work the same way in form view our design view.
In Access 365, open main form, right-click sub-form datasheet columns that need width adjustment, use the Field Width to adjust, click on border of main form to select Layout view, and save changes.
Open subform in datasheet view (by double click on subform in the left pannel)
Resize columns as you want by dragging or by right-click the column header for the column for which you wish to adjust the width and select the “Field Width” item from the context menu.
Right-click the subform border to bring up the context menu. Click the “Save” item in the context menu.
Either open the Main Form in Layout View or directly open your Subform in Datasheet View. Right Click on the Field Header, select Field Width, and enter the desired width. Save. Bewm.
My solution (Access 2016) was to create the main & subform, recreate the subform on its own using form wizard and set it up the way I want it, rename the original subform to something else, and finally rename the recreated subform to the original form name. Open the main form and the subform should be laid out the way you want it. You can then delete the original subform you renamed.
I am working in PyQt. The existing code (extremely long and sources almost all the org.'s s/w) has sections which is responsible for creating tabs and textboxes. But, being a newbie to PyQt, I am not clear on how it all works. For my part, I need to do the following:
(1) Create a TAB titled 'xyz' within the row of all the other tabs.
(2) Create 6 textboxes with individual labels in the page displyed by the created TAB where the user can enter data and save it.
These are the two immediate problems I have to deal with now. Later,
The data entered in the textboxes will replace the data in bar-graphs (in another window) as soon as the data in the textboxes is entered and saved. This is to be done afterwards but first I need to solve the 2 issues listed above. The imports are all there in the (longish) code and I have to insert my new code within that code - perhaps by creating a new class. Can you help? Thanks. And, please let me know if you need any information to work on this.
EDIT::::::::::: Have inserted the image below. As you can see, at the top of the left pane, there are multiple tabs in a row (all made in PyQt). I need to create a tab like the last one (here, titled-Incentives) with a blank page like the one shown below the tab. Within the page, I need to create 2 sets of textboxes, 3 textboxes in each set with labels for the set(s) and the individual textboxes. Data entered in the boxes will be integers(20) and the data will then go on to populate/update a dynamic stacked bar graph. At this point, I want to ask another question. When the data updates the graph, should it be first saved in the DB (the DB which is primarily responsible for the initial figures in the graph) and then routed to the graph or should the data update the graph directly, bypassing the DB and if so, won't the graph revert to its earlier values and forget the data from the textboxes once it is reset. Thank you.
OK. Here you have a code that you can use as a starting point for your own development. It creates a QTabWidget with two tabs. The "Tab 1" tab contains a vertical layout with two groupboxes. Groupboxes contain labels and textboxes arranged in a grid. The other tab is empty.
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class MyMainWindow(QMainWindow):
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
# Create the tabbed widget
self.central = QTabWidget(self)
self.setCentralWidget(self.central)
# Create a new tab
self.tab1 = QWidget()
# Tab has a vertical layout
self.vbox = QVBoxLayout(self.tab1)
# Tab children: two groups containing a grid of labels and textboxes
self.group1 = QGroupBox("Group 1")
self.textBox1 = QLineEdit(self.group1)
self.textBox2 = QLineEdit(self.group1)
self.fillGroup(self.group1, self.textBox1, self.textBox2)
self.group2 = QGroupBox("Group 2")
self.textBox3 = QLineEdit(self.group2)
self.textBox4 = QLineEdit(self.group2)
self.fillGroup(self.group2, self.textBox3, self.textBox4)
# Add tab children to the tab layout
self.vbox.addWidget(self.group1)
self.vbox.addWidget(self.group2)
# Append tab to the tabbed widget
self.central.addTab(self.tab1, "Tab 1")
# Create a new tab and append it to the tabbed widget
self.tab2 = QWidget()
self.central.addTab(self.tab2, "Tab 2")
def fillGroup(self, group, box1, box2) :
"""Arrange the groupbox content in a grid layout"""
grid = QGridLayout(group)
label1 = QLabel("Input 1:", group)
grid.addWidget(label1, 0, 0)
grid.addWidget(box1, 0, 1)
label2 = QLabel("Input 2:", self.group1)
grid.addWidget(label2, 1, 0)
grid.addWidget(box2, 1, 1)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ui = MyMainWindow()
ui.show()
sys.exit(app.exec_())
Please notice that for my convenience I've used a QMainWindow as a parent for the tabbed widget. Obiously you can use other widgets as parent if you need it.
Hope it helps.
I have a table view with a search bar. When I put some text in the search bar & search data I display different rows under different sections. I have enabled UIGestureRecognizer on the section header to collapse the rows. Once user tap on the section header I set the data objects to nil leading to number of rows returned for those sections as 0.
After the I call the following piece of code to refresh my search table view. It all works fine with exception that I can see "No Results" on the screen just below my collapsed sections. This works fine in non-search mode - collapsing the sections does not display "No Results" message there.
[self.searchController.searchResultsTableView reloadData];
I could see a private property _noResultsLabel & a _searchDisplayControllerFlags option as noResultsMessageAutoDisplay (set to 1) inside class UISearchDisplayController. Not able to reset them.
Any idea on this?