[Solved] Event triggers for text control?

Creating and using forms
Post Reply
owlbrudder
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am

[Solved] Event triggers for text control?

Post by owlbrudder »

On a form I can add controls and they all have associated events which can trigger macros. The only type of control not having events seem to be those associated with a table - at least, the form has an associated table it can scroll through and controls on the form are tied to fields in the table. Is this right, or am I misunderstanding something?

To explain further: I would like to raise a visual flag if a certain value appears in a control as the user scrolls through the records and I was going to use control events for this, but there don't seem to be any events.

Any help would be appreciated.
Last edited by owlbrudder on Wed Nov 09, 2016 3:37 am, edited 1 time in total.
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Event triggers for text control?

Post by Villeroy »

A table control on a form is a bundle of controls. Each column represents one control of any type. See column properties. There is no formatting for individual rows nor columns and no macro can add this missing feature. The best you can get without macros is a formatted field with conditional number format. Formatted fields are very much like numeric spreadsheet cells with the same number format attributes, e.g. red font color for negative numbers: #,##0.00;[RED]-#,##0.00
Reports can do more if you use the report builder extension or if you use Calc for database reports.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
owlbrudder
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am

Re: Event triggers for text control?

Post by owlbrudder »

Thanks for the quick response. I have found I can manully add a text control (for example) and set its datasource as a field of the form's recordset and this control retains all its events, so I have a work-around for when I need it.
Cheers,
Doug
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Event triggers for text control?

Post by Villeroy »

You can also hide and unhide form controls.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
F3K Total
Volunteer
Posts: 1044
Joined: Fri Dec 16, 2011 8:20 pm

Re: Event triggers for text control?

Post by F3K Total »

Hello,
find attached another approach, using a query to find the event and display the information in a textcontrol having the same backgroundcolor as the form itself. An information will appear, if the NUMBER is less than -50.
Attachments
TriggerEvent.odb
(16.9 KiB) Downloaded 268 times
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 11 AOO, LO | Linux Mint AOO, LO
owlbrudder
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am

Re: Event triggers for text control?

Post by owlbrudder »

Villeroy wrote:hide and unhide form controls.
Good - I was counting on that for when I use a manually-created data control. I would have the standard control invisible and my control over the top of it. Thanks for the suggestion.
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
owlbrudder
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am

Re: Event triggers for text control?

Post by owlbrudder »

F3K Total wrote:find attached another approach
Thanks - that is very kind of you. I will study your technique as it sounds like a simplification of what I was planning to do.


... Later ...

F3K Total, solving the problem through SQL is a neat alternative. Now I can use either method depending on the circumstances. Thank you again. :D
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
F3K Total
Volunteer
Posts: 1044
Joined: Fri Dec 16, 2011 8:20 pm

Re: [Solved] Event triggers for text control?

Post by F3K Total »

Hello,
find attached a combination of Villeroys idea and a query, using a number in a formatted field of a grid control to display a colored text. Looks like this:
C.PNG
C.PNG (7.94 KiB) Viewed 4962 times
The query gives back 0 or 1, and the field is formatted like this:

Code: Select all

[<=0][RED]"ATTENTION, less than -50!!!";[>0][BLACK];General
Attachments
TriggerEvent2.odb
(17.91 KiB) Downloaded 253 times
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 11 AOO, LO | Linux Mint AOO, LO
owlbrudder
Posts: 93
Joined: Tue Nov 08, 2016 8:04 am

Re: [Solved] Event triggers for text control?

Post by owlbrudder »

F3K Total wrote:The query gives back 0 or 1, and the field is formatted like this:

Code: Select all

[<=0][RED]"ATTENTION, less than -50!!!";[>0][BLACK];General
Yes, that is a good solution for a grid or list fed by a query rather than directly by a table.

I expect there are other ways to approach this as well, so I have some more study to do. Many thanks for taking the time to help.
Cheers,
Doug
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
Post Reply