How to load a picture to a control


Badge +4

Hey guys,

I'm wondering if anybody could help me. 

I created a SmartObject with a Picture-Property. After this i loaded some pictures into the db and saved it. (I know it's not the best style and won't lead to good performance but it's only two pictures and probably won't be more than 3-4 in the future so i guess it's okay for the moment)

Well this leads me to the issue: I have a Drop-Down-Control which refers to the SmartObject. Now I want to load the picture, which refers to the chosen dataset, and show it on the View/form. But how can I do that? I've read that the Picture-Control is a readonly-Control and can only show static data. I also looked up whether I can load the data to a data-label or sth. like that but it only shows the HTML-Code from the database.

Does anybody has got a clue how to solve my issue?

 

Best Regards

Sparrow


9 replies

Badge +7

Unfortunately, you can't tie the event or smartojbect from the drop-down to the picture control.

 

One way I believe this can be accomplished is if you create a separate view from your smartoject and load the view with a rule that in Initialization, it will fire the load event from your smartoject to load a picture control.  So you would build a separate view from a wizard from your smartoject, then load in a parameter with something like LoadPictureID (Number).  Below, I built the view from right clicking on my smartoject and selecting "design view".  When the wizard loaded, I selected to only bring in my Picture control (called Icon).

 

Below is how I build it.  What I would do is when the drop down is changed, to transfer the ID from the drop-down control to this view and re-initialize the view.  Benifit from this approach is that you can see if the data is transferable from your database to the picture control.

 

12980iB3B74A27F15BCA76.png

 

Let me know if this is confusing or if this isn't the design approach you were looking for.

Badge +7

Showing the results of a seperate view for your picture control.

 

I created a form with a view of a drop-down list and the view with the previous picture control.  On the rules from the Form level, I said when the drop down is changed, to transfer the AutoID tied to the drop down to the parameter of the Picture control view...then Initialize the picture control view.

 

13183i7CC7F9372141F89C.png

Badge +4

Hey daerne, 

thanks alot for your fast reply. 

 

If I understand you correctly, it's not possible to load the picture from the database and show it on the screen? As far as I understand your reply I should create an Image Attachment Control. But as far as I remember I can't really show the picture to the user like an icon would do it, am I right? So what I need is a possibilty to dynamicly show pictures (logos) to the user who is looking on the form. 

Excuse me, if I understood you incorrectly. 

 

best regards 

Sparrow

Badge +4

Found a solution. 

Downloaded a Community-Control called Dynamic Image.

Works fine for me. 

Thanks for all your help! 

 

Best regards 

Sparrow

Userlevel 4
Badge +13

Hi Sparrow


 


I assume that you are using a Item view, But i suggest that you have a look at my screenshot and explanation and advise if something like this will be of use to you, as it seem so to be alike to what you need to accomplish. although this can be done in a list,editable list or item view.


 


13649i1D56DACC5EB4098B.png


 


Explanation:


 


Basically the cross and correct mark are images that are displayed depending on a selection that was made. Example if the Liability is  a value of 2.00 or higher then the correction image will be shown next to it, otherwise if the Liability value is less that 2.00 then the cross image would show.


 


Note that the stucture of when the image should be displayed can be changed, the above a simply a single example of how it can be used.


 


Please advise the functionality of your request and if this will be of use to you ?


 


Kind Regards


Raymond

Badge +4

Hi Raymond,

that's comes close to what I had in mind.

 

On a View/Form I've got a Drop-Down-Control where I choose between some Salesorganisations. Regarding on which I choose, there should appear a Logo which changes if I change the Salesorganisation.

 

I put these Salesorganisations into a SmartObject which have a property called Image also. My aim was to load the right picture from the database(/SmartObject) to the screen so that it's visible for the user. 

 

As I pointed out one post before yours that I found a Community-Control called "Dynamic Image" which allows me to load data dynamicly from the output of the "Load"-Method of my SmartObject and show different Pictures. This comes very close to what I had in mind.

 

Thanks to ur reply as well 

and best regards

Sparrow

Userlevel 4
Badge +13

Hi Sparrow


 


Basically how this suggestion of mine work is it has a checkboxlist with option "A,B and C" and a data label that will contain a certain image depending on the selection made in the chekboxlist.


My images are not retrieved from a database, instead they are retrieved from K2 Designer itself (C:Program Files (x86)K2 blackpearlK2 smartforms DesignerStylesPlatinumImagesIcons).


 


When a option is selected in the checkboxlist the image is displayed accordingly and the record can be save, loaded or deleted from or to a smartobject.


 


The above is all being done with a rule contructed on the checkboxlist.


 


I have attached my package for you to have a look at, hopefully this will help you to the full extend.


 


Kind Regards


Raymond

Badge +4

Hi Raymond,

that's a good alternative to my solution. I will use that in further projects!

Thanks for your help. :)

Best regards 

Sparrow

Userlevel 4
Badge +13

Hi Sparrow


 


Thank you for the quick feedback.


I am glad i was able to provide you with the required outcome.


 


Kind Regards


Raymond

Reply