I am using Visual Basic 2010 and I have a tab control called "TabControl1" and I try this code:
TabControl1.AutoScroll = True
But I just get the error:
AutoScroll is not a member of System.Windows.Forms.TabControl
If this is wrong; how am I supposed to add scroll bars to my TabControl?
Thanks.
Related
I am creating a simple power BI custom visual , which will have an image which when clicked will open the link in new browser window/tab. I have followind code in the constructor of visual.ts:-
constructor(options: VisualConstructorOptions) {
this.svgRoot = d3.select(options.element).append("svg");
this.rectElement = this.svgRoot.append('svg:a')
.attr('xlink:href', 'https://someurl')
.attr('target', '_blank')
.append('svg:image')
.attr('xlink:href' , 'http://imageurl')
}
I have tried following for target attribute:-
with no "target" attribute, the link opens in the same frame as the visual in this case
with "target" set to _parent and _top I get error which says:- "The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set."
with "target" attribute set to _blank, nothing happens here when I click on image.
I want _blank to work so that the link opens in new tab or browser window, can this be achieved.
I am trying to change the color of the button in my Universal App.
This is the line:
Button.Background = new SolidColorBrush(Color.FromArgb(a,r,g,b));
But i get the error saying 'Color' does not exist in current context...
Do i need to include something or?
The Color is declared in Windows.UI;
I have started to automate my windows application using coded UI tests recently and facing issue while accessing some of the MSAA control.
I am hand coding my automation and do not want to add controls to UI Map and then use it.
The control on which I got stuck is a treeItem on a left pane which selects machine and details are displayed in left over client area at the center.
I have tried to search control using properties as shown by crosshair onto the UI control but in vain.
Below is the code I have tried -
UITestControl machine = new UITestControl(App);
machine.TechnologyName = "MSAA";
machine.SearchProperties.Add(WinTreeItem.PropertyNames.ControlType, "TreeItem");
machine.SearchProperties.Add(WinTreeItem.PropertyNames.Name, "Machine1");
machine.SearchProperties.Add(WinTreeItem.PropertyNames.ControlName, "m_tvPlantStructureView");
Mouse.Click(machine); // This code gives an error
ERROR-
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException:
The playback failed to find the control with the given search
properties. Additional Details: TechnologyName: 'MSAA' ControlType:
'TreeItem' Name: 'Machine1' ControlName: 'm_tvPlantStructureView'
---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
Refer to attachments.
Let me know, what is the problem and what process to follow to completely get away of such kind of errors of controls not recognized in future.
Currently, I follow the method of doing a crosshair and getting properties and then coding on that property of control to automate user actions and assertions. But this way does not always work.
Let me know if there is any better way of doing it.
You need to do a hierarchy search. Create 2 controls: first the Treeview as Window. With control name m_tvPlantStructureView, then create a new TreeItem with name Machine1.
var treeView = new WinWindow(App);
treeView.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "m_tvPlantStructureView");
var machine= new WinTreeItem(treeView);
machine.SearchProperties.Add(WinTreeItem.PropertyNames.Name, "Machine1");
Mouse.Click(machine); // This code gives an error
Another thing if this fails is to remove App from treeview and add window title.
Let me know if you have any questions.
var treeView = new WinWindow();
treeView.WindowTitles.Add("mywindowname");
treeView.SearchProperties.Add(WinWindow.PropertyNames.ControlName, "m_tvPlantStructureView");
var machine= new WinTreeItem(treeView);
machine.SearchProperties.Add(WinTreeItem.PropertyNames.Name, "Machine1");
Mouse.Click(machine); // This code gives an error
Before doing the mouse clik, I perform a search of the control using
machine.Find();
After that, I check if machine has a value distinct of null, and if is it not null, i perform the click.
I'm using c++/cli with visual studio 2010 express edition.
What I want to do is create a panel that is invisible but that still accepts/receives the click and double click messages and possibly other mouse input. If I set the controls visibility to FALSE then this seems to disable any mouse input.
I have tried getting the paint message and doing nothing (as was suggested by other sources) to try and make the panel simply not draw but not be invisible however the panel still seems to be drawing.
What should I be doing in the paint message to tell windows that I have draw the panel?
My panel drawing function is:
private: System::Void panel1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
}
If there are any other suggestions about how I could achieve this then that would be helpful.
In the end I scrapped this idea all together, the problem was to get a way of getting the mouse input from a window that had been "parentented" by a NativeWindow class. This meant that the window I was expecting to receive messages (the child window) was not receiving the messages.
In order to get the messages you need to override the event handler in your parent NativeWindow class. Here you can handle the event This is where I got the solution:
http://msdn.microsoft.com/en-us/library/system.windows.forms.nativewindow.createhandle.aspx
Is there a way to get a LightSwitch Screen's controls collection?
Something as simple as:
Me.Controls
This will give you the screen:
Dim control = Application.Current.RootVisual
Although, most of the controls on the screen aren't named and need to be referenced by their textblocks in the visual tree.
Have a look at the following thread (user samneric1) where I had the requirement to hide one of the menu items on the screen....
http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/194b53eb-0e21-49a6-9312-c640bf53d659/
Steve