[Solved] Searching in a textbox storing values as properties

Discuss the database features

[Solved] Searching in a textbox storing values as properties

Postby RPG » Wed Aug 23, 2017 7:28 pm


Somes it is possible to solve a problem but there rest some idea's to make it better. I did make once a macro for searching in a textbox. There was one problem: The dialog I did use must be open for as long the searching continue. [Solved] Searching in a textbox is the old topic

Learning about the module Beans
When I did read in the API I did became interested in the module Beans. First it was only what means it and is it important? So I start reading all things in the module Beans. I did get the idea that it can be helpful for me but it was not clear in what way. On one moment I did discover that beans are special useful in forms and controls. On that moment I did remember the old project searching in a textcontrol. Now I did have a good reason to continue with study the Beans.

Storing values in a control with properties
With reading in the module Beans I did learn I can store values as a special property in a control. First I did work with the struc I need for searching this is a special search struc. It did work but there was one problem when I closed the program then all was forgotten: there was only a name and no more struc. I could make a code to solve also this problem but I was not happy. On one moment I thought that it was better to store different properties and not a struc with all properties. Later I came on the idea to make also a property what make clear the textbox must be searchble or not.

I hope The macro is now, as I think, so good that normal users can use it without understanding the code. They have only to make three buttons in a form and also the Library in which all code is must be loaded. I think when you work with simple form it can work easy. A simple form is: There is only one main-form in your doc-form and the text conrol is in that mainform.

For programmers
I think the macro code is complete and does not use a lot of tricks. I do program in BASIC but I do believe the BASIC code is only for setting things for the API. The searching what is done in the program is done by the API; I do only set values for the API.

What is the reason why I'm glad with the solution I have now. The dialog is covering the text box and that is not real nice. I did not have a solution for searching when the dialog was closed. It was possible to work with Gobal variables but I do not like it. With the variables as a property in a control it is much more clear how it work. I think I have not a lot of reason to trust BASIC. Storing all values in the control make it now possible:
1) ask first for the settings what and how you want search
2) Search in more then one textcontrol.
3) Search left and right.

Villeroy did remember me that it was better to let open the document in working mode and not in edit mode. I have changed it.

 Edit: I have replaced an earlier version of this program. The reason was that in BASIC not always the properties are been recognized. I must work with object.getpropertyvalue("name") or with object.setpropertyvalue("name",value). The problem seems special after they have been defined the first time and not later. That is maybe the reason it is discovered so late. 

Search in a textcontrol.
(38 KiB) Downloaded 57 times
LibreOffice on openSUSE Leap 15
Posts: 2164
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Return to Base

Who is online

Users browsing this forum: No registered users and 5 guests