Grid Control display issues

image Ratslinger
All grid controls I use are completely from code

Then I’ll code them in. I just thought that it would be less error prone to let Calc define them.

image Ratslinger
Initial look and the scroll bars don’t seem to be implemented.

No matter how many times I have switched the scroll bars option to either horizontal, vertical or both, and saved them they always defaulted to none, next time I have opened the file.

Just getting ready to go somewhere but looked at my Dialogs with grid controls and there are no scroll bar issues.

See my answer & COMMENTS here → Macro insert data into table control @dialog

Time flies…

Got this far (500 of same line but has the scroll bar):

Now trying to figure how to incorporate in your code. Kind of all over as far as what I need.
Again, problem with grid control in the GUI. Code seem to work much better.
Had it for tonight. Will look again tomorrow.

Thank you so much. Myself, on the other hand, am learning how to create forms and controls programmatically. I got both, now I’m trying to establish listeners and handlers.

I’ll include in the sample when I get there.

Hello
Thanks for answer of my needs (almost) from this link: Apache OpenOffice Community Forum - [Solved] Horizontal large table inside a dialog - (View topic)
Now i miss a way of after show data in the db grid locate( Column, KeyData etc…) a certain among all others; or some kind of Go To Line. Are there some built in features or do i have to build all it my self?
I mean, how to Look fo data in a Grid Collumn
But also a way of “clearing data in the grid” before reaload new data

You need to build it yourself - nothing built in.

As in the past you have not explained what you are doing so have no direct answer for this. Typically when a grid is displayed in a dialog it is filled when the dialog is called to be displayed.

Solvede:
oDataModel = oDlg.getControl(“tab_g1”).model.GridDataModel
’ Limpa todos os dados == ZAP in memory
oDataModel.removeAllRows()

Now i’m trying this:
oRowSelection = createUnoService(“com.sun.star.awt.grid.XGridRowSelection”)
oDlg.addControl(“tab_g1”, oRowSelection )

’ Later with a commadn button my listner
dim mygrid1 As Object
myGrid1 = oDlg.getControl(“tab_g1”)

myGrid1.SelectAllRows() ** Does nothing **
Can you help
best regards

@dosreis57
Please ask this and others as new question. You continue to bury questions in other posts which are barely related. It make it difficult for others to find. Will not answer buried questions anymore.


Edit:
Testing has this as a bug. Found the answer & tested OK:

oControl.Model.SelectionModel = com.sun.star.view.SelectionType.MULTI

Other functions work.
Only new and not buried questions please!

Hello,

Have what seems to work. Give it a try.

deleted bad version

Most changes in Forms->CreateGridControl

I state most as there where so many issues in integrating my working Dialog with your code as to not exactly remember what or where.

There may be other issues, but with your literal for the directory I needed to change, you can get that from the document itself. Its the file URL - strip off the file name.

@Ratslinger
Thank you very much for doing all this. I see there is an extensive amount of modifications which I need to go through and learn. Unfortunately, it is kicking me out at the following line:

Globalscope.BasicLibraries.LoadLibrary( “MRILib” )

I managed to learn how to create a Dialog form and insert a control button on it. I also created a listener and handler for that button, which successfully fires up. Although, there are tons of questions still unanswered. For instance, it is still extremely cumbersome for me to read the API reference. I’m still trying to determine where to find a list of listener prefixes. Or which which listeners associate with which controls. I’m attaching a file of what I have learned (by looking at other folks code samples mostly) so far in the last 24 hours. In all honesty, even though I will definitely thoroughly go through all the modifications which you have done, I am very grateful for the suggestion of actually creating those controls programmatically. It is definitely the way to go.

Program2.ods (9.8 KB)

Yeah was about to post a modified version. Also corrects a couple of other issues. There is also a mouse handler. Just double click anywhere on grid.

ProgramPost.ods (26.1 KB)
{2nd Corrected version - eliminates duplicate columns).

Edit:

Thanks for the reminder. Generate listener prefixes with code. See my post here → How to properly code a broadcaster and listener in LO Basic

Thank you once again! I need some time to digest through this now and let you know how it goes :slight_smile:

Had a quick look at your sample. You have mouse button and push button mixed together with an action event.

For ‘mouse’ left, right, middle, single, double clicks examine my mouse event. oEvent contains results if you examine with a tool such as MRI.

Another item to see → Creating Event Listeners

Unfortunately that modified version still kicks me out at the same line.
LO basic error message

Must have goofed up again. It occurs a few times. Just delete the line(s). Will clean it again & post corrected copy.
.
Edit:

Post now has corrected version noted as corrected version

It works! You got it!! :slight_smile: I noticed the columns repeat themselves, when you scroll to the right, is that part of the workaround? Not the end of the world, at all, just curious.

Before I plunge in all the modifications you have done, I want to read again Mr. Pitonyak’s chapters 10 through 13. Every time I look at this text, as well as “Useful Macro Information” I find yet something I missed before. Either way I will mark this thread as resolved, because you got it to the point where it truly is. And I’ll post future questions in new threads so that folks can subsequently refer to them, looking for answers. Once again, thank you very much for your time and your input. There is no way I could have done this on my own with my limited knowledge of this craft and time available.

No. another missed item I need to correct again. There columns are input twice. Give me 5 minutes & will fix.

Edit: fixed columns and horizontal scroll gone and grid larger.

@marus_b this is related → UNO Grid Control

1 Like

deleted intentional