Forum Stats

  • 3,837,263 Users
  • 2,262,245 Discussions
  • 7,900,240 Comments

Discussions

View logo functionality on click of a button

user5108636
user5108636 Member Posts: 1,760 Silver Badge

Hi All, Using Forms 12c. Need a logo viewing functionality when the user clicks a button the link to the logo file opens and shows up. Is there any similar example of this functionality done in Oracle forms.

Comments

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,294 Employee

    It's not exactly clear what you are asking, but if I'm understanding correctly, you can either use a button to display your logo and add your code to the WHEN-BUTTON-PRESSED trigger OR you can use an Image item and use the WHEN-MOUSE-CLICKED trigger. The second option is not ideal if being accessibility compatible is necessary.


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • user5108636
    user5108636 Member Posts: 1,760 Silver Badge

    Hi Michael, I am open to both options. Let's say we take the first option, use a button to display the logo.

    Few questions for option 1

    1) which item will the logo be displayed in when the "view logo" button is clicked.

    2) Do you have an example code for this implementation. Also, please explain in detail how to implement.

    With Option 2,

    1) How will this work, are you able to provide an example or detail with sample code

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,294 Employee

    Sorry but I don't fully understand your use-case. I was simply saying that if you wanted to have an image/logo "clickable" you have two options:

    Option 1

    Use an image item and add a WHEN-MOUSE-CLICK trigger to it. In that trigger add the desired code.

    Option 2

    Use a button and make it "Iconic" and display your logo in that button. In its WHEN-BUTTON-PRESSED trigger add the desired code.



    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • user5108636
    user5108636 Member Posts: 1,760 Silver Badge
    edited Jul 13, 2022 1:36AM

    Hi Michael, Apologies for the confusion. I want the end user to view logo image on click of a button or just view the logo on the form. The logos are stored in database table as a clob column.


    When the user selects a record in the maintain institution logo section, the logo should show up where the view logo button is placed. Similarly need to implement code to upload logo to the database as well.

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,294 Employee
    edited Jul 13, 2022 1:46PM

    I will assume you meant to say that the logos are stored in a BLOB and not a CLOB. If so, just add an Image Item to the form in the multi-record block. Set the item's property "Number of Items Displayed" to 1. As the user navigates from record to record the image will change to reflect the currently selected row/record. There's no need for a button or extra action on the user's part. You'll end up with something like this:

    EDITED:

    If you still prefer to use the button approach, simply set this new Image item's Visible property to No at design-time. At runtime, in the button code set the Image item Visible property to true (i.e. PROPERTY_TRUE). You will need a way to toggle the image on and off. Likely with this approach a radio button or single check box would be better than a button. For example:


    We love Oracle Forms... 😉


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

    user5108636
  • user5108636
    user5108636 Member Posts: 1,760 Silver Badge
    edited Jul 19, 2022 7:49AM

    Thanks Michael, the view logo functionality in forms works fine now. You are right it's BLOB and not CLOB :).

  • user5108636
    user5108636 Member Posts: 1,760 Silver Badge

    Hi Michael, Also, as part of the functionality I need the image upload also to work. Is there a working example for the same.

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,294 Employee

    If you want to upload images from the user's machine you will need to WebUtil enable your form. Once WebUtil enabled, you can then decide if you want to present a File Save dialog or just assume the files and their names are known and located in a known location.

    There are many documents in MyOracleSupport that offer same code for using WebUtil. There is also information about WebUtil in the Form Builder Help.


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM

  • user5108636
    user5108636 Member Posts: 1,760 Silver Badge

    Lastly, I am not able to display transparent background images in the Image forms component. Have read in Oracle Support that forms does not support transparent images. Has anyone got a workaround for this.

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 7,294 Employee

    For images that were previously stored in the database through Forms (pre-"Native" option), they will continue to appear as they did originally. New images uploaded and downloaded using the "Native" option should do the right thing.

    Here is a lower level explanation as to how Forms works with images:

    Any images that are loaded through the Forms image processing layer, which begins with READ_IMAGE_FILE, are internally converted and compressed to a more efficient format. As a result, things like transparency information is lost. This design was intentional years ago because both server and networking were not nearly as efficient as they are today. Rather than altering the old processing layer and risking destabilizing customers' applications it was decided to create the new "Native" option, which bypasses the old image processing layer. In short, the result is the image uploaded remains exactly as it was uploaded and therefore downloaded exactly the same.

    Something to consider based on the above;

    Although "Native" is only available as a property value for image items, similar functionality can also be achieved with canvas background images. Historically, a canvas background was "imported" and this imported image was processed through the image processing layer then its binary data stored in the source file (FMB). The result was that the image caused the FMB/FMX to be much larger because it now had an embedded image stored within it. Further, because it was processed through the Forms image processing, the quality of the image likely was degraded compared to the original. If you are using 12.2.1.3+ you can now use SET_CANVAS_PROPERTY to programmatically load an image from a URL or JAR. The resulting image will visually appear far better than if you had imported it at design time. Also because the image is not embedded in the FMX, the memory footprint of the X file will be smaller.

    If you have not already review it, I recommend reviewing the Forms New Features Guide. It covers some of what I mentioned here and more.

    https://www.oracle.com/a/tech/docs/oracleforms-1221-newfeatures.pdf


    Michael Ferrante

    Senior Principal Product Manager

    Oracle

    Twitter: @OracleFormsPM