Ask Your Question
0

can't get dialog graphic to stick

asked 2016-02-17 18:05:48 +0200

jay Arr gravatar image

updated 2016-03-07 21:38:07 +0200

Alex Kemp gravatar image

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:

image description

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:

image description

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

    DialogLibraries.LoadLibrary("Standard")
 ' sort out dialogType
    select case dialogType
        case=mbSTOP
            oDialog1 = CreateUnoDialog( DialogLibraries.Standard.DialogStop)
        case=mbQUESTION
            oDialog1 = CreateUnoDialog( DialogLibraries.Standard.DialogQuestion)
        case=mbEXCLAMATION
            oDialog1 = CreateUnoDialog( DialogLibraries.Standard.DialogAlert)
        case=mbINFORMATION
            oDialog1 = CreateUnoDialog( DialogLibraries.Standard.DialogInformation)
        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 !?

image description

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

image description

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 ... (more)

edit retag flag offensive close merge delete

Comments

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

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

2 Answers

Sort by » oldest newest most voted
0

answered 2016-02-21 22:25:36 +0200

jay Arr gravatar image

updated 2016-02-28 17:55:25 +0200

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

edit flag offensive delete link more
0

answered 2016-02-20 17:52:49 +0200

pierre-yves samyn gravatar image

updated 2016-02-22 11:16:33 +0200

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

edit flag offensive delete link more

Comments

"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

JohnSUN gravatar imageJohnSUN ( 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 :)

pierre-yves samyn gravatar imagepierre-yves samyn ( 2016-02-22 11:10:15 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-02-17 18:05:48 +0200

Seen: 156 times

Last updated: Feb 28 '16