Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: CBXE8 - Adding an icon to TListBox ?


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Oct 7, 2015 6:48 AM Last Post By: GAI CHEW KAI
GAI CHEW KAI

Posts: 117
Registered: 7/25/14
CBXE8 - Adding an icon to TListBox ?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 30, 2015 2:14 AM
Embarcadero® C++Builder XE8 Version 22.0.19027.8951 and Indy 10.
Window 10 Pro x64
Android 4.1.2

QUESTIONS

1. Where should I place the .PNG file via Project->Deployment->Remote Path in order to LoadFromFile() successfully ?

eg.

String sn = ? // what should I place here ?

// lbxMember...is TListBox
lbxMember->ItemByIndex( 0 )->ItemData->Bitmap->LoadFromFile( sn );

Please advise.
GAI CHEW KAI

Posts: 117
Registered: 7/25/14
Re: CBXE8 - Adding an icon to TListBox ?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 7, 2015 6:48 AM   in response to: GAI CHEW KAI in response to: GAI CHEW KAI
...found the answer:

Set the Remote Path to ".\assets\internal" for Android.

To use LoadFromFile():

UnicodeString us;

us = System::Ioutils::TPath::Combine( System::Ioutils::TPath::GetDocumentsPath(), "test.png" );

TImage* pImage;
pImage = new TImage( this );
pImage->Align = TAlignLayout::Left;
pImage->Height = 35;
pImage->Width = 35;

pImage->Bitmap = new TBitmap( 32, 32 );
pImage->Bitmap->LoadFromFile( usFile ); // NOTE: test.png is 32x32 in size.

To add into TListBox:

We use TRectangle, and add it into a TScrollBox:

TRectangle* pRect = new TRectangle( this );

// You define the pRect attributes here...

// sbxBrowser...is a TScrollBox component.
sbxBrowser->AddObject( pRect );

pRect->AddObject( pImage );

DONE.

Hopes, this helps.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02