Solved

How to store image on datawindow in PB8.

Posted on 2004-08-20
7
925 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
7 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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 100 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
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 and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

770 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