# can't get dialog graphic to stick [closed]

Using LO Version: 4.4.6.3 on an iMAC with OSX 10.10.5

[Warning this is a LONG description for a short question]

I'm building a series of dialogs as a more flexible & customisable version of MSGBOX but I'm having trouble getting the graphic icons to stick in the design. Here's my Information dialog design:

You'll see that I've just added the graphic (the blue circle with the I )

if i exercise the TEST MODE ON/Off you'll see all is as it should be like this:

If I now save the design and open the dialog with this code:

'============================================================================================
' general purpose test harness for developing routines
sub Testy
call DialogMsgBox("this is a test message",mbInformation,"This is the TITLE", "Btn1 Text", 7)
end Sub

'============================================================================================

function DialogMsgBox(theMsg as string, dialogType as integer,theTitle as string,_
Button1Text as string, Button1Response as integer, _
optional Button2Text as string, optional Button2Response as integer, _
optional Button3Text as string, optional Button3Response as integer, _
optional DefaultButtonNo as integer) as integer
dim oDialog1        as object
dim oDialog1Model   as object
Dim NoOfButtons     as integer
Dim oMsg            as object
Dim oTitle          as object
dim oCMD1           as object
dim oCMD2           as object
dim oCMD3           as object
dim oGraphic        as object

' sort out dialogType
select case dialogType
case=mbSTOP
oDialog1 = CreateUnoDialog( DialogLibraries.Standard.DialogStop)
case=mbQUESTION
oDialog1 = CreateUnoDialog( DialogLibraries.Standard.DialogQuestion)
case=mbEXCLAMATION
case=mbINFORMATION
case=mbCONFIRMATION
oDialog1 = CreateUnoDialog( DialogLibraries.Standard.DialogConfirmation)
end select

oDialog1Model = oDialog1.Model
'    msgbox oDialog1Model.Dbg_Properties
' set the graphic
oGraphic= oDialog1Model.Graphic
msgbox oGraphic.Dbg_Properties
'    msgbox oGraphic.Dbg_Methods

' get no of buttons
if isMissing(Button2Text) then
NoOfButtons=1
else
if isMissing(Button3Text) then
NoOfButtons=2
else
NoOfButtons=3
endif
endif
' assign DefaultButtonNo
if isMissing(DefaultButtonNo) then
dbno=1
else
if dbno>NoOfButtons then
dbno=1
else
dbno=DefaultButtonNo
endif
endif

' assign Title
oDialog1Model.Title=  oDialog1Model.Title & " " & theTitle
' and the message
oMsg=oDialog1Model.Msg

oMsg.Text=themsg & chr(13) & chr(13) & "The Number of buttons=" & cstr(NoOfButtons)
' make button(s) visible with text
oCMD1= oDialog1Model.CommandButton1
oCMD2= oDialog1Model.CommandButton2
oCMD3= oDialog1Model.CommandButton3
select case NoOfButtons
case = 1
oCMD1.EnableVisible=FALSE
oCMD2.EnableVisible=FALSE
oCMD3.EnableVisible=TRUE
oCMD3.Label=Button1Text
case = 2
oCMD1.EnableVisible=TRUE
oCMD2.EnableVisible=TRUE
oCMD3.EnableVisible=FALSE
oCMD1.Label=Button1Text
oCMD2.Label=Button2Text
case = 3
oCMD1.EnableVisible=TRUE
oCMD2.EnableVisible=TRUE
oCMD3.EnableVisible=TRUE
oCMD1.Label=Button1Text
oCMD2.Label=Button2Text
oCMD3.Label=Button3Text
end select

oDialog1.execute()

End function


What I get is this !?

What's more If I go back to the design and re-open with EDIT it I see this:

Notice that the graphic is missing ?!

My 1st question is what am I doing wrong, or is this a bug?

My 2nd question is I'd like to collapse the four dialog's into one general purpose dialog but for that I'd have to be able to make the background ...

edit retag reopen merge delete

### Closed for the following reason question is not relevant or outdated by Alex Kemp close date 2020-08-30 16:36:05.066789

What type and size of this icon "Info"? Try convert it to small PNG before embedded it to form

( 2016-02-18 08:24:57 +0200 )edit

Sort by » oldest newest most voted

JohnSun & Pierre-yves Samyn thanks for your contributions which helped.

I scaled the image to fit and stopped using a graphic on the dialog and swapped it for a button which I disabled.

I discovered by looking at dialog.Dbg_Properties that the dialog's background can be changed by using .imageURL and similarly the button's graphic can be changed. However the difference is that the dialog's background can be set to scale and fit but the button's cannot.

If you would like to see examples of the final implementation of my customised dialog message box see this link

more

Hi

First... I do not see any image in your question (only image desription), is this normal?

[EDIT]

With the images I understand the problem and reproduced. It is indeed a bug already reported.

A workaround could be to store the image e.g. in a document like in DlgPicto.ods (click Dlg then LoadImage)

[END EDIT]

1) Another technique, less known than enable visible (hide) controls: use the Page (step) properties of the latter.

Controls with this property = 0 are always visible.

Change dialog to "page" (eg.) 1:

oDlg.Model.step = 1


This enable visible only the controls with that value in their Page property (and those with 0 as already said).

The dialog in DlgStep.ods includes 5 overlapping image controls (same size & position). Click Dlg button in the example to start the dialog. Then click Info, Error... to display the picture.

This technique allows grouping controls and manage their visibility easily but it makes more tricky the design due to the overlay. This could perhaps answer your second question as well as create controls "on the fly".

2) Click the MessageBox button to see an example of the createMessageBox interface, also less known, which allows you to manage settings with the constant names.

Regards

more

"don't see any image in question" I don't see it too. So I does right-click and open link in new tab - save image to my PC and look it. This is a .tiff-files

( 2016-02-21 10:07:22 +0200 )edit

I could not find it because the text does not appear as a hyperlink. Thank you @JohnSUN :)

( 2016-02-22 11:10:15 +0200 )edit