Hello Jorge,

On Mon, Feb 11, 2013 at 07:31:15PM -0600, jorge ivan poot diaz wrote:
> Hello,
> I've done the tutorial about but the expected result was not successful,
> here is the link:
> 
> http://wiki.openoffice.org/wiki/Tutorial_About

Those tutorials are rather old, the code has changes in between.


> I've noticed that the source code has changed for example:
> 
> cui/source/inc/about.hxx
> 
> +       OKButton        aOKSureButton; (tutorial)
> +       OKButton        maOKButton;  (source code)
> 
> I understand that the source code has been modified but I want to know why I
> have added the code does not work, does not generate the button. If the
> button OKButton if successfully generated.
> 
> Please I want to know the reason why I can not generate the button.

I have no idea what you have done. Can you generate a patch with your
changes?


> Another important point of the code cui / source / dialogs / about.cxx gives
> me the impression that has changed because the code shown before the
> structure is completely different this is

It has obviously changed since 2007,
http://svn.apache.org/viewvc/openoffice/trunk/main/cui/source/dialogs/about.cxx?view=log


>  // OK-Button-Position (at the bottom and centered)

ups, it's not centered, but positioned on the left!

>     Size aOKSiz = maOKButton.GetSizePixel();
>     Point aOKPnt( ( aDlgSize.Width() - aOKSiz.Width() ) - a6Size.Width(),
> nY );
>     maOKButton.SetPosPixel( aOKPnt );
> 
> 
> How I can implement the tutorial about in the source code to generate the
> button?
> 
> What would be the changes I should make to the source code?
> 
> Help me.

The sources are at:

cui/source/inc/about.hxx - header
cui/source/dialogs/about.cxx - source file
cui/source/dialogs/about.hrc - IDs defines
cui/source/dialogs/about.src - dialog structure definition


Apply the attached patch, build, deliver, and copy the library in your
office installation:

]$ cd <SRC_ROOT>/main/cui
]$ cat <PATH_TO_PATH> | patch -p1
]$ build debug=true dbglevel=3  && deliver
]$ cp -fv <unxlngx6>/lib/libcui.so  <BASIS_DIR>/basis4.0/program/libcui.so


Once you get a general idea of how it works, try changing something
else: modify the button type, make it a simple push button, and add
a call back so that when it is pressed you show a "Hello world!" message
box.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina
diff --git a/main/cui/source/dialogs/about.cxx 
b/main/cui/source/dialogs/about.cxx
index b753a3f..4ef4e81 100644
--- a/main/cui/source/dialogs/about.cxx
+++ b/main/cui/source/dialogs/about.cxx
@@ -282,6 +282,7 @@ namespace
 AboutDialog::AboutDialog( Window* pParent, const ResId& rId ) :
     SfxModalDialog( pParent, rId ),
     maOKButton( this, ResId( RID_CUI_ABOUT_BTN_OK, *rId.GetResMgr() ) ),
+    maOKButtonCenter( this, ResId( RID_CUI_ABOUT_BTN_OK, *rId.GetResMgr() ) ),
     maReadmeButton( this, ResId( RID_CUI_ABOUT_BTN_README, *rId.GetResMgr() ) 
),
     maVersionText( this, ResId( RID_CUI_ABOUT_FTXT_VERSION, *rId.GetResMgr() ) 
),
     maBuildInfoEdit( this, ResId( RID_CUI_ABOUT_FTXT_BUILDDATA, 
*rId.GetResMgr() ) ),
@@ -434,11 +435,14 @@ void AboutDialog::LayoutControls( Size& aDlgSize )
     maMainLogoPos = Point( 0, nY / 2 - aMainLogoSz.Height() / 2 );
     maAppLogoPos = Point( nCol1 + a6Size.Width(), 0 );
 
-    // OK-Button-Position (at the bottom and centered)
+    // OK-Button-Position (at the bottom and right)
     Size aOKSiz = maOKButton.GetSizePixel();
     Point aOKPnt( ( aDlgSize.Width() - aOKSiz.Width() ) - a6Size.Width(), nY );
     maOKButton.SetPosPixel( aOKPnt );
 
+    // center the button in the middle
+    maOKButtonCenter.SetPosPixel( Point( aDlgSize.Width() / 2 - 
maOKButtonCenter.GetSizePixel().Width() / 2, nY ) );
+
     maReadmeButton.SetPosPixel( Point(a6Size.Width(), nY) );
 
     aDlgSize.Height() = aOKPnt.Y() + aOKSiz.Height() + a6Size.Width();
diff --git a/main/cui/source/inc/about.hxx b/main/cui/source/inc/about.hxx
index 552086d..0fbb63b 100644
--- a/main/cui/source/inc/about.hxx
+++ b/main/cui/source/inc/about.hxx
@@ -38,6 +38,7 @@ class AboutDialog : public SfxModalDialog
 {
 private:
     OKButton            maOKButton;
+    OKButton            maOKButtonCenter;
     PushButton          maReadmeButton;
     FixedInfo           maVersionText;
     MultiLineEdit       maBuildInfoEdit;

Attachment: pgpH2wSOqyMKt.pgp
Description: PGP signature

Reply via email to