×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Feb 2004
    Posts
    29

    Display text and picture~~~

    DEAR ALL...

    Beside using CTextView and CRichText, how to display text and pictures in one view with scrollbar???

    Hope anyone who knows can tell me.

    Thank you.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,

    there is not any native Avkon class in Series 60 allows displaying text and image together.

    Bye

  3. #3
    Registered User
    Join Date
    Feb 2004
    Posts
    29
    Oh...
    Thanks.

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    sorry...

    Hi,

    sorry, my previous answer was not correct, on Series 60 could be easily combined text and pictures in rich text object. Look on the piece of code below:

    ------------------------
    // thumbnail update
    CThumbPicture* picture = new( ELeave ) CThumbPicture( *( my_image ) );
    CleanupStack::PushL(picture);
    // header stores information about picture
    TPictureHeader header;
    header.iPicture = TSwizzle<CPicture>( picture );
    iRichText->InsertL( iRichText->DocumentLength(), header );
    CleanupStack::Pop();
    ------------------------

    where CThumbPicture is CPicture derived class, in which only pure virtual methods are implemented:

    ------------------------
    // ***************************************************************************
    /// \brief The class defines the protocol to support picture embedding
    ///
    class CThumbPicture : public CPicture
    {
    public:

    ///
    /// \brief C++ default constructor.
    /// \aram aBitmap - Bitmap
    ///
    CThumbPicture( CFbsBitmap& aBitmap );

    ///
    /// \brief Prohibit break before and after the picture
    ///
    TBool LineBreakPossible( TUint aClass, TBool aBeforePicture, TBool aHaveSpaces ) const;

    ///
    /// \brief Pure virtual in CPicture. Draws the picture
    ///
    void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const;

    ///
    /// \brief Pure virtual in CPicture.
    ///
    void ExternalizeL( RWriteStream& aStream ) const {};

    ///
    /// \brief Pure virtual in CPicture. Get size.
    ///
    void GetOriginalSizeInTwips( TSize& aSize ) const;

    ///
    /// \brief Set size.
    ///
    void SetOriginalSizeInTwips( TSize aSize );

    private:

    /// size
    TSize iSize;
    /// displayed bitmap
    CFbsBitmap* iBitmap;
    };


    How easy ye?
    BIG SORRY ONCE MORE...

    Regards
    STeN

  5. #5
    Regular Contributor
    Join Date
    Jun 2004
    Posts
    86

    ETEXT 31?

    hi! is it possible to do this:

    // thumbnail update
    CThumbPicture* picture = new( ELeave ) CThumbPicture( *( my_image ) );
    CleanupStack::PushL(picture);
    // header stores information about picture
    TPictureHeader header;
    header.iPicture = TSwizzle<CPicture>( picture );
    iRichText->InsertL( iRichText->DocumentLength(), header );
    CleanupStack::Pop();

    only when a user presses a command button and not during initialization of richtext object? when i do this, on first try, nothing happens. but when i press a command button again (second time), i get ETEXT 31 panic. what is ETEXT 31 panic?

  6. #6
    Regular Contributor
    Join Date
    Jun 2005
    Posts
    52
    Originally posted by stenlik
    Hi,

    sorry, my previous answer was not correct, on Series 60 could be easily combined text and pictures in rich text object. Look on the piece of code below:

    ------------------------
    // thumbnail update
    CThumbPicture* picture = new( ELeave ) CThumbPicture( *( my_image ) );
    CleanupStack::PushL(picture);
    // header stores information about picture
    TPictureHeader header;
    header.iPicture = TSwizzle<CPicture>( picture );
    iRichText->InsertL( iRichText->DocumentLength(), header );
    CleanupStack::Pop();
    ------------------------

    where CThumbPicture is CPicture derived class, in which only pure virtual methods are implemented:

    ------------------------
    // ***************************************************************************
    /// \brief The class defines the protocol to support picture embedding
    ///
    class CThumbPicture : public CPicture
    {
    public:

    ///
    /// \brief C++ default constructor.
    /// \aram aBitmap - Bitmap
    ///
    CThumbPicture( CFbsBitmap& aBitmap );

    ///
    /// \brief Prohibit break before and after the picture
    ///
    TBool LineBreakPossible( TUint aClass, TBool aBeforePicture, TBool aHaveSpaces ) const;

    ///
    /// \brief Pure virtual in CPicture. Draws the picture
    ///
    void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,MGraphicsDeviceMap* aMap) const;

    ///
    /// \brief Pure virtual in CPicture.
    ///
    void ExternalizeL( RWriteStream& aStream ) const {};

    ///
    /// \brief Pure virtual in CPicture. Get size.
    ///
    void GetOriginalSizeInTwips( TSize& aSize ) const;

    ///
    /// \brief Set size.
    ///
    void SetOriginalSizeInTwips( TSize aSize );

    private:

    /// size
    TSize iSize;
    /// displayed bitmap
    CFbsBitmap* iBitmap;
    };


    How easy ye?
    BIG SORRY ONCE MORE...

    Regards
    STeN


    i've done the aboce code already, but why is that only a quadratic symbol appeared in the rich text editor? what do i need to do to make the image visible? please help....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×