Solved

How to store image on datawindow in PB8.

Posted on 2004-08-20
7
919 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deletiā€¦
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now