How to show an icon in a TButton? - user-interface

My main form has a TActionList component connected to TImageList. The problem is that the TImageList was moved recently in a DataModule. Now when I assign an action to a TButton, the image associated to that action does not appear in the button.
How to fix this, while keeping the image list in the data module?

You Should assign the Images Property in TButton To the same ImageList.

It works for me.
Of course, the DM's unit must be included in the form's unit (in a uses list), and the TButton's Images property must be (re)set to the image list.

Related

How to create a multipage HMI project in twincat3?

I’m trying to create a multipage HMI in "Twincat3 Beckhoff".
The problem is when we use to bring to front other keys are useless.
when we use to send to back we have problems such as the other keys don't work correctly. I want to open a separate page.
What you're looking for are .content files. As explained on InfoSys:
Creating navigation
Switch to the Solution Explorer.
Add the desired number of content objects:
1 Right-click on the TwinCAT HMI project entry or on one of the
folders.
2 Select Add and New Item and select Content.
Open the view or the content where you wish to add the navigation.
Add a region and buttons in order to switch between the contents.
Set the Target Content attribute in order to define the start content.
Add a SetTargetContent action to the .onPressed event of all buttons and set the corresponding content.
You can hide all the objects you do not want to be displayed by coding on the New Page Call Button.
TcHmiButton::Visibility = hidden[enter image description here][1]
The second solution is to make the page we want to call small, but increase the width and height of the page to be coded by coding in the desired button.

Watir clicking nested elements inside a container

I'm trying to complete a happy path e-commerce payment test but I cant seem to click on the nested element for credit card to be honest I'm not entirely sure which is the clickable element.
Any help to get this working would be appreciated.
When inputting forms, you typically want to interact with input and select elements. In this case, you can see that the visible input field is a radio button - ie <input type="radio">.
You access radio buttons using the radio method and select it by using the set method:
browser.radio(id: 'cc-payment').set
The element you want to click is the input with type radio. You should be able to do something like:
driver.find_element(:css, "input[id='cc-payment'][value='creditCard']").click
I'm curious if clicking on the parent item would resolve.
#browser.input(id: 'cc-payment').parent.click
If the div registers the click and sets the input then this might work. You should be able to manually verify this beahviour by clicking outside of the radial and seeing if it selects.

Can I search for an object by its name within a form in VB6?

As declared in the title, for example, I want to search for a button whose name is button8, within a form where there are so many buttons that I do not want to check the name one by one.
Can I do this in VB6?
You should just be able to refer to the control via the controls collection, like so:
Me.Controls("Button8")
See this link.
Here's how to find a control in the form designer, if you know the name.
Go to the form designer, open the property window (press F4), and use the dropdown to choose the control. This shows the properties in the window (and you can edit them). It also selects the control onscreen.

plupload, how to allow descriptions for uploaded images

I am trying to use the plupload flash widget as it works in all browsers for multiple image upload.
For every image I want my users to select a property from a dropdown box. As every image used in my site represents a property image type ex- rear image, side image, front image etc.. these options will be in the dropdown.
I would like to know, if I can dynamically inject a dropdown to pluploader.
Here is an image to see as how exactly I would like to have the drop down box for every image.
http://www.diigo.com/item/image/2ma3g/9wsq
Upon inspection of the jQuery queue element it is easy enough to determing how to inject your dropdown box into the DOM.
Because it is based on jQuery you can simply use something like..
$('#uploader_filelist li').each(function(index,data){
$(this, '#plupload_file_name').append('<html>Your html here</html>');
});
That is a very simple sample but that is how you would inject markup dynamically into the queue.
The problem is when you do it? And how to identify it later. With this you need to go back to the plupload API and attach events (Documentation here) to the following:
public event FilesAdded(uploader:Uploader, files:Array)
public event UploadProgress(uploader:Uploader, file:File)
And you will need to handle chunks in the script as well as the uplaod handler you are using to retrieve the dropdown value using multipart_params that get set on each chunk uploaded.
Adding the drop down is easy, making sure the process is handled all the way around is another problem and can take some time to perfect.

FoxPro sum form fields

Using autogenerated form from a single database table. The form uses the class WizBtns included in c:\Program Files\Microsoft Visual FoxPro 9\Wizards. The form has Top, Previous, Next and Bottom buttons.
Although the form only has textboxes to enter data for the fields in the table, I have added a custom Text Box from the toolbox which basically intends to display the sum of some fields. I have bound the ControlSource of the text box to a PUBLIC variable costTotal that is created on the form init.
Now the problem is updating the sum of fields in the text box, or simply updating value of costTotal. Where to add the code for this? Adding the code in the form's Refresh method mixes up the value of costTotal, when I press Next button to update all fields with new values, the custom text box displays the sum of the last record which is mysterious.
I would add a method to the form to do the calculation. Then, call that method from the Valid method of each of the textboxes involved in the calculation.
There is nothing wrong with using the refresh event to recalculate the values, just make sure that you call the refresh each time the record changes
If you are using navigation buttons to move between records then the click event of EACH button is an ideal place to issue the refresh request :-
Assuming the textbox is called txtSum and is located on the same form as the navigation buttons then in each buttons click event add this code
dodefualt()
with thisform
.txtSum.refresh()
endwith
Couple of things:
1) do not use the wizards! Make your own base classes. Trying to figure out what the wizard classes do and how to add functionality will take more time that coding your own base classes. Also, the wizard generated code and classes must be at around 10/20 years old, much has changed since then (a polite way to say they suck).
2) Do not EVER use public variables in FoxPro, except for maybe an app object.
If this is a one shot thing, just add default textboxes and buttons and design the form yourself. You will have total control and you will know what each thing does.

Resources