[Libreoffice-bugs] [Bug 134232] TextBox: the text assigned to the Text property isn't displayed in UI (v6.0.x .. 6.4.4.2)

2020-09-12 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=134232

BogdanB  changed:

   What|Removed |Added

 CC||buzea.bog...@libreoffice.or
   ||g
 Blocks||103494


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=103494
[Bug 103494] [META] Textbox bugs and enhancements
-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 134232] TextBox: the text assigned to the Text property isn't displayed in UI (v6.0.x .. 6.4.4.2)

2020-07-16 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=134232

TFKane  changed:

   What|Removed |Added

 Status|NEEDINFO|UNCONFIRMED
 Ever confirmed|1   |0

--- Comment #3 from TFKane  ---
Hi Xisco,


I made a mistake.


Hoping the following details allows to avoid other users to made the same
mistake.


To make long story short, there are two way to read and update controls
contents (e.g., TextField):

1) read/update controls content immediately before the dialog is shown:

Sub ShowDialog134232
BasicLibraries.LoadLibrary("Tools")
oDialog134232 = LoadDialog("Standard", "Dialog134232")
oText  = oDialog134232.getControl("MyTextBox")
msgbox "updating <"+oText.Text+"> ... (will succeed)"
oText.Text = "Bug 134232 ... updated text"
oDialog134232.Execute()
End Sub


2) read/update controls content on user interaction (e.g. button click):

Sub ButtonClicked_ProperWay(Event as Object)
Button = Event.Source()
Context = Button.getContext()
oText = Context.getControl("MyTextBox")
msgbox "updating <"+oText.Text+"> ... (will succeed)"
oText.Text = "it works"
End Sub


To make long story long, keep reading.


MODULE AND DIALOG DESCRIPTION


The attached module (Module134232) and form (Dialog134232) will explain both
the flaw and the proper way to proceed.


Dialog134232 has three controls:

- MyTextBox: a textbox with preassigned text "Bug 134232"

- WrongWayButton: a button labelled with the text "Update Text - Wrong Way"

- ProperWayButton: a button labelled with the text "Update Text - Proper Way"



Module134232 has three subs:

- ShowDialog134232: to show dialog and allow user to interact with it

- ButtonClicked_WrongWay: called on the WrongWayButton button click

- ButtonClicked_ProperWay(Event as Object): called on the ProperWayButton
button click

All subs pops up a message with the current text and the message that the text
is going to be changed



STEP BY STEP USAGE

Load module and dialog in LibreOffice Calc.

Then, choose Tools -> Macros -> Run Macro

"Macro Selector"  dialog will be shown.

Select MyMacros -> Standard -> Module134232 in the "Library" tree on the left
side, then choose ShowDialog134232 in the "Macro Name" list on the right side.
Click Run.

A message box with the text "updating   (will succeed)" will be
shown.
Click "OK".
The message box disappears and the Dialog134232 become visible.
The text in the MyTextBox text field "Bug 134232" has actually been replaced
with "Bug 134232 ... updated text".

Click the "Update Text - Wrong Way" button.
A message box with the text "updating   (will fail)" will be
shown.
Click "Ok".
The message box disappear and the text field remains unchanged.

Click the "Update Text - Proper Way" button.
A message box with the text "updating   (will
succeed)" will be shown.
Click "Ok".
The message box disappear and the text field is replaced with "it works".


CONCLUSIONS

Essentially, my mistake - at least as far as I can understand - was the attempt
to update fields on a button click in this way (ButtonClicked_WrongWay is
assigned to button "Execute action" event):

Sub ButtonClicked_WrongWay
BasicLibraries.LoadLibrary("Tools")
oDialog134232 = LoadDialog("Standard", "Dialog134232")
oText  = oDialog134232.getControl("MyTextBox")
msgbox "updating <"+oText.Text+"> ... (will fail)"
oText.Text = "this won't be displayed"
End Sub

The Sub body actually create a new Dialog instance and interact with it,
leaving unchanged the displayed one.


The right way to do this, is:

Sub ButtonClicked_ProperWay(Event as Object)
Button = Event.Source()
Context = Button.getContext()
oText = Context.getControl("MyTextBox")
msgbox "updating <"+oText.Text+"> ... (will succeed)"
oText.Text = "it works"
End Sub

However, I was unable to find any documentation that illustrated the above.
Indeed, I had to guess the the "Event as Object" parameter existance.

IMO, the LibreOffice Basic documentation should be integrated with a more
accurate API documentation and possibly many examples. At least, in my
experience.

Hoping this post was helpful.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 134232] TextBox: the text assigned to the Text property isn't displayed in UI (v6.0.x .. 6.4.4.2)

2020-07-16 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=134232

--- Comment #2 from TFKane  ---
Created attachment 163140
  --> https://bugs.documentfoundation.org/attachment.cgi?id=163140=edit
Bug 134232, Dialog and Module

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 134232] TextBox: the text assigned to the Text property isn't displayed in UI (v6.0.x .. 6.4.4.2)

2020-07-13 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=134232

QA Administrators  changed:

   What|Removed |Added

 Whiteboard| QA:needsComment|

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 134232] TextBox: the text assigned to the Text property isn't displayed in UI (v6.0.x .. 6.4.4.2)

2020-07-13 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=134232

Xisco FaulĂ­  changed:

   What|Removed |Added

 CC||xiscofa...@libreoffice.org
 Status|UNCONFIRMED |NEEDINFO
 Ever confirmed|0   |1

--- Comment #1 from Xisco FaulĂ­  ---
Thank you for reporting the bug. Please attach a sample document, as this makes
it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive
information before attaching it. 
See
https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F
for help on how to do so.)

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


[Libreoffice-bugs] [Bug 134232] TextBox: the text assigned to the Text property isn't displayed in UI (v6.0.x .. 6.4.4.2)

2020-07-06 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=134232

QA Administrators  changed:

   What|Removed |Added

 Whiteboard|| QA:needsComment

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs