Ask Your Question
0

What event on what object should I attach my GUI object retrieval code to?

asked 2012-05-29 21:10:14 +0200

leeand00 gravatar image leeand00
11 3

updated 2013-01-27 21:30:38 +0200

qubit gravatar image qubit flag of United States
5693 3 48 41

I have a function that loads up references to GUI objects in a LibreOffice Base Form, and I was wondering which of these events (on the form?) I should attach it to if the rest of the code on the page depends upon references to these GUI objects.

There are many options for attaching the loading code to the form

' This method gets run when the page is loaded.
Sub Init()
  Doc = ThisComponent
  TheForm = Doc.DrawPage.Forms.GetByName("Form")

  CbBoxFeature = TheForm.getByName("CbBoxFeature")
  CbBoxDESPName = TheForm.getByName("CbBoxDESPName")
  cbUpdateToState = TheForm.getByName("cbUpdateToState")
  txtDetails = TheForm.getByName("txtDetails")
  lblStatus = TheForm.getByName("lblStatus")
End Sub

Here is my form loading code.

delete close flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2012-11-20 21:21:14 +0200

sdy7 gravatar image sdy7
1 1 1 1

Hi leeand00

Did you ever figure this out? I think I have the same challenge. I wanna do stuff from a macro upon form load. For example when attaching this to a button action:

Sub Macro_stuff (oEv as object)
    oEv.source.model.Refresh
    >or other stuff here<
End sub

But when assigning that macro to the "When loading" event on form, oEv object does not seem to be instantiated to anything useful. I tried "Xray oEv" too. Is there another work-around maybe?

Thanks in advance

Søren

link delete flag offensive edit

Login/Signup to Answer

Donate

LibreOffice is made available by volunteers around the globe, backed by a charitable Foundation. Please support our efforts: Your donation helps us to deliver a better product!

Question tools

Follow
2 followers

subscribe to rss feed

Stats

Asked: 2012-05-29 21:10:14 +0200

Seen: 143 times

Last updated: Nov 20 '12