Solved

How to store image on datawindow in PB8.

Posted on 2004-08-20
7
933 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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.

856 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