[Solved] Event isn't working !
[Solved] Event isn't working !
Hey there.
I have a document form with a sub-form that show a table grid control. In one of its columns i have set an event when the mouse button is release to run my function. Works fine, but.... now Instead to set a table as data source, i created a SQL command as data source to fill the table grid with the command result.
As soon as i did that change, the event didnt work anymore. In fact the function is never called. When i click on some cell on the column i added the event, isnt getting blue selected as before, only cell border obtain the focus now.
Why ? which is the problem ? how to fix it ?
thx in advance
I have a document form with a sub-form that show a table grid control. In one of its columns i have set an event when the mouse button is release to run my function. Works fine, but.... now Instead to set a table as data source, i created a SQL command as data source to fill the table grid with the command result.
As soon as i did that change, the event didnt work anymore. In fact the function is never called. When i click on some cell on the column i added the event, isnt getting blue selected as before, only cell border obtain the focus now.
Why ? which is the problem ? how to fix it ?
thx in advance
Last edited by Hagar Delest on Sat Sep 09, 2017 10:12 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1549
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Event isnt working !
The reason for your problem is:
The SQL command only displays data on the table.now Instead to set a table as data source, i created a SQL command as data source
Is telling you the data on the table can't be edited, as a result there is no Event.isnt getting blue selected as before, only cell border obtain the focus now.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
-
- Volunteer
- Posts: 1549
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Event isnt working !
I should point out that queries that join multiple tables result in Table controls where the data fields can't be edited.
If the query references a single table then the Table control will allow editing, and Events will work.
If the query references a single table then the Table control will allow editing, and Events will work.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
-
- Volunteer
- Posts: 828
- Joined: Fri Nov 30, 2007 10:58 am
- Location: Scotland
Re: Event isnt working !
While this is often the case, I believe a work-around is available.queries that join multiple tables result in Table controls where the data fields can't be edited
See [Example] Queries that can edit multi-tables. It will only work, however, if the Query/SQL is routed via the Base parser: direct SQL mode is not effective.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Re: Event isn't working !
yes, the table cant be edited because it is filled by the sql command, that's clear, but what have to be with that question the event ?
In my opinion the event must jump as before, because there isnt a reason to dont do it, i think.
Anyways you said that is some way to do it, how about it ?
The reason i need that event on certain table grid column, is to open other form with the filter to the text on the table cell, a very useful feature.
thx in advance
In my opinion the event must jump as before, because there isnt a reason to dont do it, i think.
Anyways you said that is some way to do it, how about it ?
The reason i need that event on certain table grid column, is to open other form with the filter to the text on the table cell, a very useful feature.
thx in advance
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 1549
- Joined: Wed Jun 24, 2015 12:56 am
- Location: Colorado, USA
Re: Event isn't working !
In my opinion the event must jump as before, because there isnt a reason to dont do it, i think.
Apparently the OO developers didn't share your opinion. Events are triggered by a change on the cell, and since the cells on your table can't change no events will be triggered.
As the example Arineckaig posted explains, if you change your query so that it contains all the Primary Keys and Foreign keys in all the joined database tables, then your form table may allow changes and the events should work.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
Re: Event isn't working !
but we have a property to set 'the table cant be edited'.
Still i dont understand why the event isnt jumping because if the table cant be edited, what is bad with the event ?
Still i dont understand why the event isnt jumping because if the table cant be edited, what is bad with the event ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 828
- Joined: Fri Nov 30, 2007 10:58 am
- Location: Scotland
Re: Event isn't working !
arfgh:
For a macro to reference the value of a particular cell in a grid form control, my tests indicate it is sometimes more reliable if the source of the calling event is the grid form control itself rather than one of its contained column form controls. The view and model properties of the grid form control supply respectively direct references to the column selected and to the relevant record of the underlying RecordSet.In one of its columns i have set an event when the mouse button is release to run my function.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Re: Event isn't working !
you meant to place the event in the whole trable grid control, instead in the column ? But then how we will catch the clicked cell content text ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Posts: 145
- Joined: Mon Jun 13, 2016 10:50 am
Re: Event isn't working !
Hello,
Depending of what type of value you want to retrieve, here's two methods following Arineckaig's advice:
Depending of what type of value you want to retrieve, here's two methods following Arineckaig's advice:
Code: Select all
sub themacro(event)
grid = event.Source
column = grid.CurrentColumnPosition
selection = grid.getByIndex(column)
msgbox selection.Text
end sub
Code: Select all
sub themacro(event)
grid = event.Source
column = grid.CurrentColumnPosition
form = grid.Model.Parent
msgbox form.getString(column +1)
end sub
AOOo 4.1.2 on Win7 | LibreOffice on various Linux systems
-
- Volunteer
- Posts: 828
- Joined: Fri Nov 30, 2007 10:58 am
- Location: Scotland
Re: Event isn't working !
arfgh asks:
Prevention of visible selection thus appears to forestall the trigger of consequential events. It can only be a matter of opinion whether that represents a bug or a useful feature.
Where data displayed in a Grid form control cannot - for whatever the reason - be updated, the Base GUI prevents the visible selection of that content. Such action could well be considered to be user friendly, as the lack of visible change gives warning against the frustration of futile but often repeated key entries or mouse clicks.Still i dont understand why the event isnt jumping because if the table cant be edited, what is bad with the event ?
Prevention of visible selection thus appears to forestall the trigger of consequential events. It can only be a matter of opinion whether that represents a bug or a useful feature.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Re: Event isn't working !
wanted to know also the opinion of Villeroy, it is very strange he hasnt said anything yet.....
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 828
- Joined: Fri Nov 30, 2007 10:58 am
- Location: Scotland
Re: Event isn't working !
+ 1
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Re: Event isn't working !
well, it is truth that with the event in the whole table grid the event is jumping again. but... 'column = grid.CurrentColumnPosition' that isnt working here, the error is : 'not valid object'
i think that 'CurrentComunPosition' doesnt exists...
help
i think that 'CurrentComunPosition' doesnt exists...
help
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 828
- Joined: Fri Nov 30, 2007 10:58 am
- Location: Scotland
Re: Event isn't working !
In my earlier post
The .CurrentColumnPosition property belongs to the View of a grid form control: it does not exist as a property of that control's Model. On the other hand it is its Model that holds the more direct reference to the particular record (aka. row) that has been selected.The view and model properties of the grid form control supply respectively direct references to the column selected and to the relevant record of the underlying RecordSet.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Re: Event isn't working !
ok.... and following the same, is there a way to obtain the column name or index ?
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version
-
- Volunteer
- Posts: 828
- Joined: Fri Nov 30, 2007 10:58 am
- Location: Scotland
Re: Event isn't working !
The View of the Grid Form Control has a .getCurrentColumnPosition() property that supplies the relevant column index number. In turn, that index number is applicable to the Model of the Grid Form Control to obtain that column's .Name property.a way to obtain the column name or index ?
You will be aware that the .Source property of an event set to trigger a macro, may for some events reflect the View and for other events the Model of calling object. Hence, Star BASIC code does not always readily lend itself to being copied from one application to another.
The following example has been tested, and is offered, on the presumption it is to be called by a Mouse Button Released event of the Grid Form Control - i.e. a cell in the table has been selected:
Code: Select all
Sub ShowSelectedColumnIndexName
oGridV = oEv.Source REM the view of the Grid
nColNum = oGridV.getCurrentColumnPosition()
sColName = oGridV.Model.getByIndex(nColNum).Name
Print nColNum, sColName
End Sub
Code: Select all
Sub NewMacro(oEv)
MRI oEv.Source : Exit Sub
End Sub
Please come back if you have difficulties with the MRI facility. You may well, however, prefer other means for exploring the API.
When this issue has been resolved, it would help other users of the forum if you add the word - [Solved] - to the Subject line of your 1st post (edit button top right).
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
AOOo 4.1.5 & LO 6 on MS Windows 10 MySQL and HSQLDB
Re: Event isn't working !
Yes i tried several times to use the mri extension and helped some in cases, so thx for that little example to explore with it
well at finally was possible to have again the event jumping. Yes, was very strange that thing where the event isnt working because using a query... thx
well at finally was possible to have again the event jumping. Yes, was very strange that thing where the event isnt working because using a query... thx
OpenOffice last version | Mageia Linux x64 | Ubuntu Linux | Windows 8.1 Enterprise x64 | Java last version