?
Solved

How to store image on datawindow in PB8.

Posted on 2004-08-20
7
Medium Priority
?
976 Views
Last Modified: 2013-12-26
Hi all,

  I would like to know how to store an image (BMP or GIF) into a dataWindow.  I dont want to fix a  path to the image.  What I want is to put the image into the datawindow.  Like what we can do in VB6.  Eventhought we delete that image, our program still can see that image.
When I insertRow() or retrieve(), the logo will display on screen.

  Any idea?  

Regards,
Yong Yih
0
Comment
Question by:yongyih
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:sandeep_patel
ID: 11857782
i don't know your exact requirement but it can be either of the following...

1) permanently store the image in a database table.

for that that column must be of type longbinary or blob according to yr database.

2) Just an icon or picture that u want to display on the screen but not the part of your database.

For that put an picture control in the datawindow and assign bmp or gif file to that picture control. Now your problem is that when u delete that picture file from path it is not showing on that control. So u can solve this problem while u build your executable. create a .pbr file and write down the path name of picture file in that pbr and assign that pbr file to the .pbl when u build your executable. so when u supply exe to your client no need to supply that bmps to the client. It becomes the part of your application. But remember this can not happen in development time. Also when u build executable that time the specified picture file must be there at the location defined in pbr file.

For more about pbr file u can read powerbuilder help. or u can ask here...

what control u r using in vb6 for that same ?

regards,
-Sandeep
0
 
LVL 2

Author Comment

by:yongyih
ID: 11859005
I used Picturebox.  I think as long as we didnt set the path during run time, when we generate exe file, the image will be stored in the exe fil.

1.  Actually our company is using our own framework.  Currently I am using your first method to load image (logo), which stored as BLOB from Oracle database.  But the image only will appear when I issued Retrieve() command. (and it must retrieved at least one record).  And when I print preview the dataWindow (Letter with company logo),  the logo is gone.

  That's why I am looking for another method that can store the logo in the dataWindow itself.

2.  We dont generate exe file for our program.  We only has an exe file to load our application (dataWindow) from server.

  Any idea to solve my problem in item 1.  or other way to load image? ^_^
0
 
LVL 2

Author Comment

by:yongyih
ID: 11925971
If no answer for this question, I would like to delete this question.

Thanks.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:falvaro3
ID: 11931034
Quirky kinda workaround:  
Create a button object with the PictureFile property being the image (load the image in constructor or other event).
Then make sure that the DataWindow.Print.Buttons and DataWindow.Print.Preview.Buttons properties are TRUE in the dw.
0
 
LVL 2

Author Comment

by:yongyih
ID: 11938954
Please tell me what is the command to load image (BLOB data type) from Oracle database (stored in a table), into a button (looks like image, not button) in dataWindow.

If it works, then I know how to do the rest.  

Thanks.
0
 
LVL 4

Accepted Solution

by:
falvaro3 earned 400 total points
ID: 11941886
Use the "SELECTBLOB" SQL statement to get the blob data from the db, then try to see if the SetPicture(blob) method of the button object will work for you.
From the PB help for SELECTBLOB:

Blob  Emp_id_pic
SELECTBLOB Emp_pic
        INTO  :Emp_id_pic
        FROM Employee
        WHERE Employee.Emp_Num = 100
        USING Emp_tran ;

Then, try:
dw_1.object.b_1.SetPicture(Emp_id_pic)

If the setpicture doesn't work, you may have to "offload" the blob data to a temporary image file (ie: C:\Temp\picture.bmp), then set the b_1.filename property at runtime (ie: dw_1.object.b_1.filename="C:\Temp\picture.bmp").
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question