I've been wondering how do I achieve something along the lines of this:
Task List
What I'm looking for is adding description under the title for example in the image the title is Setup Spy Camera and the description is 'Install spy camera blah blah blah'
I've read the documentation and I heard I'm supposed to use DescribedTaskRender. However I did not see any results. This is my code:
Public Class Shownames
Public Property Title As String
Public Property Description As String
Public Property Score As String
Public Property Episode As String
Public Property ID As String
End Class
Dim ShowItemCollection as Shownames
Showitemcollection.Title = ShowTitle
Showitemcollection.Description = ShowDescription
Showitemcollection.Score = ShowScore
Showitemcollection.Episode = ShowEpisode
Showitemcollection.ID = ShowID
ObjListview.addobject(ShowItemCollection)
I want ShowDescription to appear under Shownames. I've already named the DescriptionAspectName as Description but it still doesn't work. Can someone help me?
I also tried adding an image using imagelist using this: Imagelist1.Images.Add(Image.FromFile(Filepath))
but it doesn't show as well despite having associated the imagelist to describedtaskrender.
To use a DescribedTaskRender, you need to tell it what is the title, what is the description and which image each row should use. These are done, respectively, by setting AspectName, DescriptionAspectName and ImageAspectName.
You'll also need to increase the RowHeight so that both the title and the description can be seen. Set it to 60 for a first guess.
Finally, you'll need to set a name for your image when you add it. You then use that name to reference the image you added.
The demo has all of this stuff on display and in reasonable easy to understand code. This file should exactly how to do what you have asked: https://sourceforge.net/p/objectlistview/code/HEAD/tree/cs/trunk/Demo/TabDescribedTask.cs
Related
I have a configuration that is saved in the database. I need to show that configuration in the label name. I am unable to use a replace functionality in the Razor view while fetching label value from Display Name.
Model Code:
[Display(Name = "SomeFooText XYZ typing speed")]
public decimal SomeFooText{ get; set; }
Something like below. I'm unable to find a code that would work for this scenario.
#Html.LabelFor(model => model.SomeFooText).Replace ("XYZ", model.configurationfromDB)
or
(<label asp-for="SomeFooText"></label>).Replace ("XYZ", model.configurationfromDB)
In worst case, I can move the code to c# and hardcode the "SomeFooText XYZ typing speed" and then use string.replace or use javascript to replace but just want to see if there is something that can be used on control directly.
I am automating a windows application through a desktop session using Appium and Windows Application Driver. Certain elements I want to interact with don't have unique accessibility IDs but the combination of their class names and IDs does seem to be unique.
How can I first get a list of elements by their class name and then fetch one of them with certain ID?
I am aware that the second line of code provided is not correct, I'm just showing it to demonstrate what behavior I need.
Below is through class name:
class_elements = driver.find_elements_by_class_name("some_class_name")
Below is through an accessibility id:
specific_element = class_elements.find_element_by_accessibility_id("some_id")
specific_element.click()
Is there a way to put both of these together in a loop?
Thank you #Moshe Slavin for your suggestion
I tried the following piece of code
#pytest.mark.trial
def test_trial():
className = "UIProperty"
class_elements = ds.find_elements_by_class_name("UIProperty")
for elm in class_elements:
print(elm.get_attribute('id'))
if elm.get_attribute('id') == "System.ItemNameDisplay":
elm.click()
I decided to print the IDs as well. I got the following results:
None
None
None
...
I'm quite confused as to why this is happening. I'm using the Windows Inspect tool from SDK to gather properties of the UI elements and there definitely is and element present that matches both the class name and the ID.
It should look something like:
class_elements = driver.find_elements_by_class_name("some_class_name")
for elm in class_elements:
if elm.get_attribute('accesibilityID') == "some_id":
elm.click()
EDIT:
As #Bill Hileman has pointed out the attribute OP was looking for is accesibilityID not just id.
Thanks Bill
Hope this helps you!
Moshe Slavin answer works, but you can try like this also.
Suppose you have some class name and you are storing it in some variable like below :
className = "some class name"
then you can get all the matching class names using the below line and you are aware of that :
driver.find_elements_by_class_name(className)
Instead of finding all the elements and storing the values, store the accessibility id that you want to check in some variable like below :
accessibilityID = "some accessibility id"
Then you can search for an element which contains both the class name and accessibility id(is just for an indicative purpose, so use app related attribute which identifies required field) using the below xpath without performing any looping :
element = driver.find_element_by_xpath("//*[#class='"+className+"' and #accesibilityID='"+accessibilityID +"']");
I hope it works too...
Hi I am a very novice when it comes to scripting. I am trying to write a Jython script that will take an image that is not at the front, in imageJ, and bring it to the front. I have tried using the WindowManager but routinely run into a similar error.
TypeError: setCurrentWindow(): 1st arg can't be coerced to
ij.gui.ImageWindow
or some other form of this error. It seems as though activating an image that is not at the front shouldn't be too difficult.
Here is the code I'm using:
from ij import IJ
from ij import WindowManager as WM
titles = WM.getIDList()
WM.setCurrentWindow(titles[:1])
The WindowManager.setCurrentWindow method takes an ImageWindow object, not an int image ID. But you can look up the ImageWindow for a given ID as follows:
WM.getImage(imageID).getWindow()
Here is a working version of your code:
from ij import IJ
from ij import WindowManager as WM
print("[BEFORE] Active image is: " + IJ.getImage().toString())
ids = WM.getIDList()
win = WM.getImage(ids[-1]).getWindow()
WM.setCurrentWindow(win)
win.toFront()
print("[AFTER] Active image is: " + IJ.getImage().toString())
Notes
I renamed your titles variable to ids because the method WindowManager.getIDList() returns a list of int image IDs, not a list of String image titles.
The WM.getImage(int imageID) method needs an int, not a list. So I used ids[-1], which is the last element of the ids list, not ids[:1], which is a subarray. Of course, you could pass whichever image ID you wish.
I added the call win.toFront(), which actually brings the window to the front. Calling WM.setCurrentWindow(win) is important in that it tells ImageJ that that image is now the active image... but it will not actually raise the window, which is what it seems like you want here.
I can't seem to find any information on this, but does anyone know if it is possible to use an embedded image from my.resources within an ObjectListView SubItem?
I am currently using images stored in an ImageList control, but I find for some reason, those images get corrupted and start displaying imperfections. I don't have the problem if I pull them from the embedded resources as I previously have with the normal listview control.
I am using the ImageGetter routine to return a key reference the ImageList, however, ultimately I would like to pull these from embedded resources. I would like to also do this for animated GIF references as well.
If anyone knows a way, could you please assist. Sample code would be appreciated.
Thanks
You can return three different types from the ImageGetter
int - the int value will be used as an index into the image list
String - the string value will be used as a key into the image list
Image - the Image will be drawn directly (only in OwnerDrawn mode)
So option number 3 could be what you want. Note that you have to set objectListView1.OwnerDraw = true.
If that does not work, an alternative could be to load the images into the ImageList at runtime. There is an example here.
this.mainColumn.ImageGetter = delegate(object row) {
String key = this.GetImageKey(row);
if (!this.listView.LargeImageList.Images.ContainsKey(key)) {
Image smallImage = this.GetSmallImageFromStorage(key);
Image largeImage = this.GetLargeImageFromStorage(key);
this.listView.SmallImageList.Images.Add(key, smallImage);
this.listView.LargeImageList.Images.Add(key, largeImage);
}
return key;
};
This dynamically fetches the images if they haven’t been already fetched. You will need to write the GetImageKey(), GetSmallImageFromStorage() and GetLargeImageFromStorage() methods. Their names will probably be different, depending on exactly how you are deciding which image is shown against which model object.
My question is about,
how to get a variable from a Magemto grid to My admin controller page.
(ie Exactly to my public function massStatusAction())
Thanks.
You can get those ID like this
$productIds = (array)$this->getRequest()->getParam('product');
Where product is set as Mass Action field in the Grid's protected function _prepareMassaction() like this.
$this->setMassactionIdField('entity_id')
Hope this helps!