How to add scroll down feature to the GUI when necessary - matlab

I'm trying to print my all inputs on the figure of the GUI. To be clear, when I have inputs like inputA, inputB, inputC, ... I want it to get shape like below.
inputA
inputB
inputC
inputD
inputE
...
...
However, what if it is much longer than y-length of the GUI? Resizing fonts is not a solution for me. Only thing comes to my mind is to have a scroll up and down feature. How can I have this? Any other solution is welcome.
Regards..

Related

Match tom select and bootstrap color?

I'm just switch from basic bootstrap 5 select to tom select, but I'm not able to match the colors of the buttons.
This is what it looks like, on the left side is the old bootstrap 5 drop, on the right side is tom select. Color for the select is "btn-outline-secondary".
Example image
Any help would be appreciated!
Was expecting the buttons to have the same border and text color
I found that if you remove the "form-select" class from the tom-select element it should render bootstrap css correctly:
document.getElementById("your_tom_element").classList.remove('form-select');
however, this is a fairly dirty solution in case you need something quick.
I would investigate whether this solution solves your problem, and then see whether some of the bootstrap classes collide with the tom-select classes.
Maybe try to provide also a bit more information regarding your block of code that is problematic.

cannot find css element in protractor

How do I locate the element with the following html, I have 4 Start buttons each in different color. I tried using css by class and is not working. There are no unique ids as well. Pls help
Start
As Ben Mohorc points out, you really need to give us a bit more to go on. But if you are saying there are multiple start buttons, but only one of each color, it ought to look like this. For now I assume all they say is "Start". If that is only part of what they say, use partial buttontext.If it is background color that differs, you may need to adapt that, too.
var coloredButton = element.all(by.buttonText('Start')).filter(function(elem) {
return elem.getCssValue('color').then(function(color) {
return (color == '#00ff00')//fill in the desired color here, in this format
})
});
Then do your stuff on coloredButton.first(), which will be the only one, according to what you are saying.
For more on the format to expect from the color, see http://www.protractortest.org/#/api?view=webdriver.WebElement.prototype.getCssValue

VerticalLayout dynamically hiding visibility

I was wondering whats the best way around dynamically hiding some menu items. At the moment I have 6 items just in a matrix layout row. I want to have 3 items aligned left and 3 items alligned right. If one of the items is set to not visible I want it to move accross. I've done something similiar in a horizontal layout and setting the visibility to hidden. I was wondering if this would work with a vertical layout? Having trouble trying to figure out exactly how I would do it as I'm quite new to UI5 xml css and javscript. Any help would be great.
Also I'm having one other issue unrelated to this, I cant seem to bind my json model to my xml fragment, if I use the same code on my normal xml view it prints out the model data. But on my fragment it just prints it like {person>/fullName} any ideas ?
Belongs to your second question.
Maybe your binding was quoted on copy and paste? Check the native XML Code.
If no data are shown (not "{person>/fullName}"), add dependent to connect the models of your view
var oFragment = sap.ui.xmlfragment(sFragment, "fragmentName", this);
oView.addDependent(oFragment);

HTML DOM Drag and Drop

Yes, this may sound like a frequent question, but Google nor stackoverflow are giving me the answer that I want. I did stumble upon a few results on the WWW, but only found HUGE scripts for just this 1 piece of functionality.
The thing is, I remember doing this before, but I don't exactly remember how. I did it within ONE function and by adding event listeners and stuff along those lines.
Basically, I need a pure DOM script to drag and drop HTML elements for a throwback to older web browsers that don't support the new HTML5 standards. Must be down with the even 'onmousedown', and the text/image must be held for at least 1.5 seconds before calling the dragging.
Thoughts and ideas? Help would be greatly appreciated, guys.
I'm also a bit rusty with screen coordinates and stuff. With this code I want the text to follow the cursor EXACTLY. Not be like, 5 pixels "off" if you know what I mean.
What I had before (parameter of moveText is supposed to be an HTMLDivElement and it's innerText):
function moveText(t){
var id=t.id;
var interval=setInterval(function(){
increment=increment+1;
if(increment>=3){
clearInterval(interval);
t.addEventListener("mousemove",function(event){
t.style.position="absolute";
t.style.top=event.screenY+"px";
t.style.left=event.screenX+"px";
});
}
},500);
t.addEventListener("mouseup",function(){
increment=0;
clearInterval(interval);
});
}

QCompleter and Tab key

I'm trying to make a Completion when pressing tab, you get the first completion of all possibilities.
But, in a QWidget-based main window, pressing tab will make that QLineEdit lost focus, and completion popup hides after that.
Is there a way to fix it ?
Have you tried to subclass QLineEdit and intercept the key press event?
Alternatively you could set up an event filter.
Whew. It took me some time to figure this out :) Multiple times I have tried to solve this problem, but always gave up. Now, I dug enough to find the answer.
OP, please pardon me, because the code here is Python, but should be understandable and work for C++ as well.
Basically, the problem I had was "how to select an entry in the QCompleter"; I didn't notice before, but the answer is in the popup() method. QCompleter works with a model and a view, which contains the things to show.
You can change the current row as you wish, then get the index of that row in the model, then select it in the pop-up.
In my code, I subclassed QLineEdit, created a tabPressed signal which is emitted every time Tab is pressed. Then, connected this signal to a method of the same class which does this:
get the current index;
select the index in the popup;
advance to the next row.
As implementation, this is very trivial, but for my current purpose this is enough. Here's the skeleton (just for the tab part, it's missing the model and everything else).
class MyLineEdit(QLineEdit):
tabPressed = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
self._compl = QCompleter()
self.tabPressed.connect(self.next_completion)
def next_completion(self):
index = self._compl.currentIndex()
self._compl.popup().setCurrentIndex(index)
start = self._compl.currentRow()
if not self._compl.setCurrentRow(start + 1):
self._compl.setCurrentRow(0)
def event(self, event):
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Tab:
self.tabPressed.emit()
return True
return super().event(event)
You may need to adjust/fix few things, but this is the basic idea.
EDIT:
For details see
http://www.qtcentre.org/threads/23518-How-to-change-completion-rule-of-QCompleter
There's a little issue: when Return is pressed, the things don't work properly. Maybe you can find a solution to this problem in the link above, or in the referenced resources therein. I'll fix this in the next few days and update this answer.
There is probably a better solution but one that comes to mind is to change the focus policy for all other widgets on the form to something that doesn't include "tab" focus. The only options that don't use the tab key are Qt::ClickFocus and Qt::NoFocus.