Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


Wrong list - try the user list not the discuss list.

On 10/03/2016 08:56 AM, Robert Großkopf wrote:
Hi meakasteve,


What I cannot do is this:  I want first to highlight a row in the
data-sheet of Form A by clicking the mouse onto the blank cell at
the left-hand side of the chosen row, then when I press the button
I want the macro not only to open the Form B but also to send data
held in one of the fields of the highlighted row of Form A (the
field contains primary key) to Form B.

Don't know how to get an event from the row-marker. But the following
code would work, if you will put it on the event "onclick" of a field
in the row you will change:

Sub Main(oEvent)
    oForm = oEvent.Source.Model.Parent.Parent
    oForm.updateString(2, "new Text")
    oForm.updateRow()
End Sub

First row connects to the form of a field in the tablecontrol. Form is
parent of the tablecontrol, which is parent of the field.
Second row updates the second field (2) with the text "new Text". If
it isn't a string you want to update, you have to change the code here.
Third row will write the code into the table, which is connected to
the form.
This will only work for updating a row, not for inserting new data to
the row.

Here some code from the German Handbook, which updates different fields:
-----------------------------------
DIM unoDate AS NEW com.sun.star.util.Date
unoDate.Year = Year(Date)
unoDate.Month = Month(Date)
unoDate.Day = Day(Date)
oForm.updateDate(3, unoDate )
oForm.updateString(4, "ein Text")
oForm.updateDouble(6, 3.14)
oForm.updateInt(7, 16)
oForm.updateRow()
----------------------------------
Updating a date is a bit tricky, because it has to be a special
variable, which defines day, month and year.

Regards

Robert




-- 
To unsubscribe e-mail to: discuss+unsubscribe@documentfoundation.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.documentfoundation.org/www/discuss/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.