Re: [tdf-discuss] Base macro accessing highlighted data

2016-10-03 Thread Joel Madero
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+unsubscr...@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



Re: [tdf-discuss] Base macro accessing highlighted data

2016-10-03 Thread Robert Großkopf
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

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
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBAgAGBQJX8n+jAAoJELDKYwaoS9AIrF8P/0O58fT6tiBR0oa2IYelwnAe
KK3rkb7xF7MIxhwUjzBaub3dPCNXuF8dy7rXhCrN9Lsxw2C5CW9xAx9dqEo7YHiy
mzXaiKCUspYShXkeSoU4+ygHXDIIu24W5a1DcZVRH1LdKad77YHOnI3UcS6lHQL/
Ep5a/MpEC9rB3g6YoU14TIgqEO4miUVseGhe9f/UdDEanXaR8EkAjfBPQj5y1QTu
0nyY6v/npxN0farHp0in5FyCSnLuxStBvXnePGbI9t9uTLXYWD9yOJW66BceEFHG
JvGKMKgd0RfL5k7knQkMVxdyULrmNldqdfzGC3QwClvp1HLs1zWWFJVx0D0Mbovf
dcRnGe3WNZkePPCQgXK1dL3IIqe2IRyHsJtmVJmLYaolHq9cL4Obu3fYahgeeVK5
mLfJi7UYLqVbSsEyxvu1AF2imbsAK2Kdt8Nc2axSq2Bh5im740G/YXESEDhxMySZ
+zLji30SvGL6o1EtXZ7JfGLV4HyMnCegoBromCutkVLjIrrkvADYBxedBPMf4kcB
v/J++8gqzK60X316r/eddQzuv8QQELEopqkWcdlNYBeedtqqwldVSLF7p/nAVnPP
Xbb7nvGOYghT2pKiP5nKq0L1GCeuJ0QHFke8cbFSa59uYt9TbQQSydX2VHlkC4f4
EoLHyjK+GwWslwNd3jt4
=3y8l
-END PGP SIGNATURE-

-- 
To unsubscribe e-mail to: discuss+unsubscr...@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



[tdf-discuss] Base macro accessing highlighted data

2016-10-03 Thread meakasteve
Hi

Can someone knowledgeable in programming macros for Base help me?

I have a form (Form A) which displays data as a data-sheet. This form also
contains a button.  When this button is pressed it activates a macros which
opens another form (Form B) in the databank. That bit I can do.

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.

If anyone can tell me the script that I need to do this I would be most
grateful.

meakasteve



--
View this message in context: 
http://nabble.documentfoundation.org/Base-macro-accessing-highlighted-data-tp4195604.html
Sent from the Discuss mailing list archive at Nabble.com.

-- 
To unsubscribe e-mail to: discuss+unsubscr...@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