How to define a widget to be hidden in the design phase? - openedge

Good afternoon,
I'm in a real messy situation here: I have a window, which contains a widget I would like to turn invisible. You might think "How easy, just add the <widget>.VISIBLE=FALSE line at the moment the widget is shown", but there's the catch: my application is an ununderstanble spaghetti of scope-defines, global variables (more than 200 of them), doing lots of things in background, ..., so I would simply like to do the following:
annoying_widget AT ROW 11.38 COL 52.86
VIEW-AS TOGGLE-BOX HIDDEN
SIZE 13 BY .77
But, obviously, this does not work, as HIDDEN is not a part of a VIEW-AS command. How can I achieve this at design-time?

You are using the AppBuilder.
Have you tried unchecking the VISIBLE and checking the HIDDEN attributes in the properties of the widget?

Related

How to detect colorisation on a text box with Squish and Robot framework?

I have a desktop application that has a form that people fill out in text boxes. If an invalid value is entered, then the box turns pink with a red border. I am using Robot framework with Squish to try and identify this error when it occurs on a certain textbox. What is the best way to do this?
Typically in QT, when actions happen they are firing signals and a slot in certain component. I'd assume that the state of the component is handled with something that triggers a signal that and the textbox receives it.
You could try to monitor what gets triggered when invalid input is given and use that in your asserts..
Another way, you might be able to read the property of your text input widget and see what changes when invalid input is given ..
Getting the internal state that results in alteration of the rendering may not be straightforward, but at least depends on which GUI technology is in use. (You have not told us yet, I think.)
A simpler approach is to use a screenshot verification point (SVP) for just that control. In that SVP, you can use a positive mask to mark a specific area that is least likely to be affected by the contents of the control (to make the SVP as robust as possible).
A similar approach is to use (verifying the actual pixel colors used for rendering on the screen) object.grabScreenshot() and use the API of the returned Image Object to query the color of an individual pixel via Image.getPixelRGB(x, y) and Image.getPixelRGBA(x, y).

Text in flash button symbols all change at once (Actionscript 2)

I have reached an impass which means I have to spend many hours doing something in a very tedious way because I can't work out a way to do it quickly, here is my problem.
In flash if I make a button that consists of a rectangle and a text field then make it all a button symbol, if I then copy the symbol to multiple instances on screen and change the text in one of them, it changes in all of them because I am changing the symbol.
How can I overcome this, perhaps with actionscript? I tried writing.
button1.text1.text = "test change button text"; on the main canvas (and giving one button a name of button one and the text field within it text1) but it doesn't work.
The only thing I found that works was to make multiple symbol copies of the button but then if I want to change the colour or dimensions of all the buttons it takes ages.
Is there a better way? Using actionscript 2 perhaps, or just some property of the button to allow individual text?
I attempted your situation... and I didn't run into your problem. Text boxes are individual values, provided that the text box is dynamic or input
I think that what may solve your problem is checking what kind of text boxes you are working with. Look in the properties panel; does it say "dynamic"?

is there a numeric Qt edit box with more than one spinner?

Before i embark on developing a custom control i wonder if somebody would know of a QT control consisting of an edit box (for a number) with more than one spinner next to it. One spinner would be used to increment/decrement the number by 10's, the other by 1's. Ideally, one could allow even three spinners (for the 100's).
There is no standalone spinner but i'm thinking maybe putting several small scrollbar controls next to each other would do.
I highly doubt that there is such a control.
Note however that a default QSpinBox supports incrementing/decrementing in steps of 10 by pressing the Page Up or Page Down keys on your keyboard.
Thanks for the tip!
I ended up creating a horizontal layout with 0 spacing, then placing three QDoubleSpinBox instances in it. On the second and third i set the max width to 15 to just show the spinners. Visually it looked great: an edit box with three spinners.
I then connected the value changed signal from the first to the second and third and the value changed from the second and third to the first. So then clicking on any of the spinners changed the value on the first correctly. Finally, i adjusted the stepsize on the spinners as needed.
It was a lot easier than what i thought it would be.

Qt style sheets are not applied immediately

I have a console window in my Qt application whose output window is a specialised QTextEdit, outputting messages that are processed after a command is parsed from a QLineEdit and subsequently executed by the main program. The window can output normal messages, warnings and, if desired, text in a number of 6 different custom colours. All 8 different types of text have their colour defined by 8 different QProperties of type QColor; these are set, along with the rest of the output window's styling, through the use of a QSS file applied to the QApplication when it loads. To write text in a certain colour, setTextColor is called on the QTextEdit just before inserting the text. (As an aside, moveCursor when called on the QTextEdit appears to reset the colour of the text to be inserted to the default colour regardless of what it was set to before, but I've made sure to set the desired text colour immediately after calling moveCursor and before calling insertPlainText.)
The problem I am having is that it appears (as far as I can see) that the styling applied through qApp->setStyleSheet is not actually applied until the message queue is processed. When the program starts it applies the style sheet and shortly afterwards a hard-coded test message is sent to the console window showing the date and time of the last compile. This message ends up being printed in the original QTextEdit colour (black), which is invisible after the black background colour in the style sheet is applied. The problem is not as simple as setting the standard text colour of the console window when the style is applied, as any number of messages could potentially be sent to the console window before the styling takes effect, resulting in any number of differently coloured messages.
I am trying to think of the best way to remedy this problem. The best way I can think of at the moment is a tagging method where messages would be enclosed in semantic tags (eg. all warning messages would be enclosed in HTML-like tags to specify that they are warnings), and when a console window's styling is applied each message would be re-coloured according to the new styling. This would obviously require hooking into some "OnStyleApplied" event for the QTextEdit. Would this be possible, or is there a better method to resolve this?
If it is really applying the qstylesheet changes in the message queue, tell the message queue to get processed before your next call.
http://qt-project.org/doc/qt-5.0/qtcore/qcoreapplication.html#processEvents
You can even specify which class of events that should be processed.
The other way that should work, is you can specifically tell the widget to apply its style changes when you want it to.
I put together an in-depth look at some advanced stuff with qstylesheets the other day:
QList: Out of memory
Note the use of polish and unpolish in the link above.
But besides all of the direct answers, you may want to look into using the classes that are made for rich text editing:
http://qt-project.org/doc/qt-5.0/qtgui/richtext.html
The structure is well thought out and you can do a lot with them. There is a learning curve to figuring them out, but it works well.
This is kind of related to what you are talking about...
Also here is a neat tool that Qt has:
http://qt-project.org/doc/qt-5.0/qtcore/qtglobal.html#qInstallMessageHandler
When you combine that with <some text editor/viewer class qt has>.append();, then when you want to add text, you can just use the qDebug() << call, and you get all the niceties of inserted spaces, newlines, and auto rendering of many Qt Classes debug string representations.
Hope that helps.

Auto Complete Extender for multiline textbox - Facebook style

I have in my application a larger textbox and offer user the possibility to enter text on several rows like this:
first piece of text
second piece of text
and so on...
Each row is a distinct piece of data that has a significance. The thing is I would like to use ajax auto complete extender functionality after the user types a certain character on a row, such as #, and filter the records in the database according to the first letter the user typed after #, moment when the auto complete suggestion list would appear. For example, third piece of text #Action1, means that after the user typed A he would be prompted with a list of values to choose from.
There are several items of concern for me: first, it is possible to use autocomplete extender only for part of the text in the textbox, and second does it work like this for multiple rows (i.e. one time - in each line behaviour)? Regarding its position, I guess I have no other choice than at the bottom of the textbox it refers to, despite I would have liked it to appear below the # symbol.
Thank you very much.
Update: I found something similar to what I am looking for here: Twitter-style autocomplete in textarea, but the author only explained briefly his solution. Any help much appreciated, thx!
Each row is a distinct piece of data that has a significance.
Why are you using a textarea then, and not multiple <input> fields?
Sounds to me like your error in UI design lies right there already, so the rest of my answer is rather theoretical; I probably won’t go into more details as the sensible fix for your problem is the one above.
first, it is possible to use autocomplete extender only for part of the text in the textbox,
Why shouldn’t it be? Cursor position in a textarea for example is readable (although it requires some working around cross-browser issues).
and second does it work like this for multiple rows (i.e. one time - in each line behaviour)?
So long as the line breaks are “hard” ones (made by the user themselves, using enter/return), splitting the actual textarea content by "\n" to have each row as a single value is no problem.
Regarding its position, I guess I have no other choice than at the bottom of the textbox it refers to, despite I would have liked it to appear below the # symbol.
You could try to roughly measure the #’s position, by line and col number it is on, and match that to the character width and line height, when using a monospace font. For other fonts, some more “magic” might be required to measure the actual width of the previous text before the # character.
I have created a Meteor package for this, which allows both free text and multiple autocomplete sources. Meteor's data model allows for fast multi-rule searching with custom rendered lists. If you're not using Meteor for your web app, (I believe) you unfortunately won't find anything this awesome for autocompletion.
https://github.com/mizzao/meteor-autocomplete
See the link for pictures of how it works. Fork, pull, and improve!

Resources