Is there any event in spreadsheetgear for worksheet column width changing? I want to perform some operation when user clicks on column separator and drags it to change its width in worksheet.
What precisely I want to do is to show a small tooltip indicating width/height of column/row, when user changes column width by column header, or row height from row header. Microsoft Excel has this behaviour, we can see a tooltip appears near column header when we change width/height for column/row.
Thanks
The WorkbookView class has an event called RangeChanged that triggers when a user changes the column width.
If you want to capture the new ColumnWidth after then change, the RangeChangedEventArgs parameter has that value.
public void workbookView1_RangeChanged(object sender, RangeChangedEventArgs e)
{
ToolTip ttip = new ToolTip();
ttip.Show(e.Range.ColumnWidth.ToString(), (SpreadsheetGear.Windows.Forms.WorkbookView)sender);
}
Be sure to add the following code to your designer.
this.workbookView1.RangeChanged += new SpreadsheetGear.Windows.Forms.RangeChangedEventHandler(this.workbookView1_RangeChanged);
Related
I am creating a line chart that contains multiple data series. In the picture below I'm showing the Chart editor of this line chart:
Every time I need to add more rows, I have to change manually the "400" value in each series. I am wondering if there is a way to create a reference to a certain cell value, so that I can just edit that cell value and have the "400" replaced with that cell value everywhere. Thank you.
Make the range references one row taller, e.g., V11:V401, and insert new rows between rows 400 and 401.
Alternatively, delete all rows below row 400. The chart will automatically add new rows as they are inserted at the bottom of the sheet.
I have a ui grid that has 20 columns, and I would like to be able to tell what the next column will be as I scroll through the horizontal axis so that I can have some text that will tell the users what the names of all the columns they can't see are.
Anyone know if this is possible? As I watch the the inspector and scroll through the columns, I see html attributes changing.
---UPDATE 1----
This is what is all looks like (where it says "home #" is dynamic and will change to show the next column that is out of site)
Based on the ui-grid configuration that you use to render the grid, you already know the order of the columns. You can use this information together with the visible on each column added by the gird itself.
What you need to do is bind a event handler on scroll to iterate over the columns on each change and check the visibility of them. Then the first one with visible === false is the upcoming.
Here is a working Plunker where is used this flag.
My application is similar to Vaadin Dashboard Demo (please click login after you visit this link). So all my mini dashboard items are wrapped around an abstract component that is of height 300px. One of those items is a Grid wrapped around this 300px height abstract component.
My customer hates it when he sees a large column and .v-grid-cell cuts his cell off:
text-overflow: ellipsis;
So in the #PostConstruct of my Vaadin Grid(and everywhere I mess with the container) i have
this.recalculateColumnWidths();
to alleviate my customer's concern. I tell him he can resize the column but he is not satisfied.
When my container size is small, most of the rows are visible and hence the column widths are perfect. When i have a lot of rows i have to scroll. The column widths are calculated based on the set of initially visible rows. When i scroll down, and if a newly visible row has a large column then the column gets cut off.
I can alleviate my problem by using HeightMode.ROW and make the parent Component a scrolling Panel like:
panel.setWidth("100%");
panel.setHeight("310px");
But I have a lot of action going on my Grid's FooterRow and so i don't want my user to have to scroll to the bottom to see the footers if row size is say 100. As a result my Grid has default HeightMode -> HeightMode.CSS. I like it. It always shows my HeaderRow and FooterRow and scrolls only the rows section of my Grid.
What have i tried:
Give each column humongous size or expand ratio. Customer rejected it.
I tried adding a listener for scroll event unsuccessfully. I used this similar question mentions. I could not get the scroll listener turned on.
ScrollingGrid.java:
public class ScrollingGrid extends Grid{
List<ScrollingGridScrollListener> listeners = new ArrayList<ScrollingGridScrollListener>();
private void fireSrollEvent() {
for (ScrollingGridScrollListener listener : listeners) {
listener.doGridScroll();
}
}
public void addScrollListener(ScrollingGridScrollListener listener) {
listeners.add(listener);
}
#Override
public void beforeClientResponse(boolean initial) {
super.beforeClientResponse(initial);
fireSrollEvent();
}
}`
ScrollingGridScrollListener.java:
public interface ScrollingGridScrollListener {
public void doGridScroll();
}
and in my Grid:
addScrollListener(this);
and
#Override
public void doGridScroll() {
Notification.show("You are scrolling!\nYou can add your own behavior here!");
this.recalculateColumnWidths();
}
I see the notification when page loads. Maybe i should not override beforeClientResponse method in Grid. But I don't know what method to override to achieve a scroll listener.
Help me figure out this scroll listener or if there is another way i can get recalculated column widths on scroll, please let me know.
Thanks for reading this very long question.
Version: 7.6.8
This is a little hard to explain so please bear with me. When I am editing a text field in one of the columns I would like to,when I hit enter, go to new line under the edited text so the grid basically expands.
Options-View-CellAutoHeight set to true expands the cell but editing is terrible.Cant
see a thing where the first line is,where it ends,etc...
Here is the grid:
I can not go after the last letter 'a' with my mouse cursor and hit enter so another line gets added. Which settings regulate this ? I know it can be done since I had a grid once and could do this.
EDIT: This requires no code just applied settings.
Just tested it with DevExpress VCL 13.2 and it can be easily done without coding (if I understood what you want to achieve).
Basically, you need to set following properties:
Assign a Memo to the Properties of your column and make sure its WantReturns property is set to true.
In your TableView set the OptionsView.CellAutoHeight property to true.
Also in your TableView, set the OptionsBehavior.EditAutoHeight to either eahEditor (editor is sized vertically to fit the content) or eahRow (the entire row is sized when editing) as needed.
I want to scroll the field so the selection is visible after resizing it. To do that I need to calculate the height from the top of the field that the selection is and then offset the current scroll to work out the new scroll. I can't assume a fixedLineHeight. Anyone have any clues?
After some searching in the dictionary I found the selectedLoc function. I ended up with the following code executed after each resize of the field which gives the behavior I wanted.
put item 2 of the selectedLoc-the scroll of pField into tSelectionHeight
if tSelectionHeight > the scroll of pField+the height of pField then
set the scroll of pField to tSelectionHeight-the height of pField
end if
In the event there's no selected location, the following also works. I use this in PowerDebug to center the breakpoint or current line of code in the debug window. (And yes, I realize I'm assuming the lineheight is consistent in the field).
command CenterDebugText pLinesToHilite
local tLineHeight, tFieldHeight
local tScroll
lock screen
set the hilitedlines of field kDebugFieldName of me to pLinesToHilite
-- center the breakpoint line in the display
-- calculate the number of visible script lines
put the effective textheight of field kDebugFieldName into tLineHeight
put the height of field kDebugFieldName into tFieldHeight
put tLineHeight * (item 1 of pLinesToHilite) into tScroll
subtract tFieldHeight / 2 from tScroll
set the vscroll of field kDebugFieldName to trunc(tScroll)
unlock screen
end CenterDebugText