Component to display multiline text in Delphi - delphi

I'm a Delphi programmer and I'm trying to write an application in which I want to show text from a telnet server.
For inputting the commands to send I'm using a TLabeledEdit and for receiving the data I'm using TIdTelnet. That works without any problems so far.
But which component should I use to display the text so the output looks like the console window?
Should I use a multiline TLabel and place it into a TScrollBox or a TMemo with TabStop property set to False or is there a better solution?

Just use a TMemo (or its alternative, TRichEdit).

You can use a TListBox if wish to add additional functionality like painting the background of certain lines of text.

Related

Issue with BringToFront in Firemonkey

I have two controls on my form.
TWebBrowser with Align set to Client
TMemo with Align set to None
I want to display TMemo on top of TWebBrowser for a particular scenario and for that am using Memo.BringToFront but it does nothing.
Am I missing something?
TWebBrowser Is a particular firemonkey Control. Firemonkey control are "paint" according to their z-order on a openGL surface (ie: the form). but TwebBrowser is a native control that is draw on another surface that is placed on the top of the form, hidding in this way everything back to it.
The only way you can do is to show you memo inside another window on the top of the TwebBrowser. for this you can use a native Memo. As far as i know their is only one native memo implemented on android (delphi already have some that work on ios/windows) it's https://github.com/Zeus64/alcinoe

Show TEdit in FireMonkey has an error in it with red border

I'm working on a mobile application where the user needs to login.
The server is returning me if the e-mail is invalid, or subdomain or password and I want to focus the TEdit that has the error. Focus is easy but I would also like to mark the edit as invalid like many web applications do.
What is the best way to do this is a consistent way so it will look correct on both Android as iOS. Is something like this built-in? I'm using Delphi 10.1
Loki's suggestion is a possible solution.
A solution which takes advantage of FMX features would be to use a TGlowEffect for the red frame around the TEdit and then use a TPopup to create the hint.
the style it's just a nightmare in 99% of the case, so i strongly suggest to not touch it. i will instead put a Trectangle as the background of the Tedit, put the Tedit as Transparent (you already have this style ready in the stylelookup in the object inspector), and then simply set the stroke.color of the trectangle.
i m working also right now on a 100% native Tedit on ios/android/windows i guess i will finish this code in around 1 week.

VCL style mac look style designer

Recently I've been doing some research in to VCL Styling (Embarcadero XE2 for Delphi).
I can load and set the styles so that works fine.
Currently I'm exploring the VCL Style Designer and what I try to figure out is how can I move the minimize, maximize, resize, close and help button to the left instead of the current default right while the application text (caption of the form) is on the right.
I am at my whits end and hope some one can give me some pointers.
So basically what I try to 'emulate' is the Mac look on a Windows form.
Any help is welcome.
What do you want accomplish is not related to the VCL Style Designer, instead you must create a custom form style hook.
Follow these steps.
Create (and register) a new form style hook descending from the TFormStyleHook class.
Override the PaintNC method to draw the title buttons in the new positions.
Handle the WM_NCMOUSEMOVE, WM_NCLBUTTONDOWN and WM_WM_NCLBUTTONUP messages to detect the status of the title buttons (hot, pressed) and fire the actions (close, restore, maximize, minimize).

Using barcode scanner with Delphi

I'm developing a POS (pet project) and I'm thinking of adding a bar code scanner to capture the sales faster. I do not have a scanner at the moment with me, and would like to ask some questions, as I'm stuck a bit.
On the sales screen my initial idea was to have an TEdit component and when a person scans the product it would fill the TEdit with the string. Now the problem I'm encountering is that I want to make the TEdit invisible so that the person does not see it. But once you make the TEdit invisible, you cannot set focus on it, so that plan cannot work.
So can anyone suggest what I can use to "capture" the scanned string? How would I make the component to listen and wait for the scanner? I assume that the scanner would be like a normal keyboard event, like button down or up.
There's KeyPreview property on TForm. Set it to true, so all key presses are processed by form first before controls.
Article about keyboard processing in Delphi: http://delphi.about.com/od/objectpascalide/a/keyboard_events.htm
Related SO question: How does Delphi's KeyPreview work?
What I have done is use the KeyPreview to monitor for a function key like F9 which the bar code scanner is set to prefix scans with. When this is received, I pop up a dialog with a single edit box and OK button. This then receives the rest of the barcode information, and the scanner ends the entry with the Enter key. I can then determine the purpose of the scanned data (in my case, one type starts with a prefix) and then put the data into the appropriate field on my main form.
I chose F9 because it seems inert in most applications, so you can use the scanner in other ways, but I support other keys too for flexibility. My application also has a scanner test mode where it shows the keys sent.
You can use a TEdit with a height and width of 0 so it won't appears and make sure it get focused when you scan your barcode.
You can also place the TEdit outside of the visible window, setting the component's Top and Left properties to something like -50. You can then set focus to it just like a regular visible TEdit box, but it will be invisible to the user.

Create a Ribbon Control in Delphi with Combobox as one of the control?

I am a newbie to using Delphi 2010 to write Ribbon Control...
I wanted a comboBox control with 5 to 6 lines for user to choose from on my ribbon...
I've set the CommandStyle of the TActionClient to csCombobox and I had a hard time figuring out how to set the content of my comboxbox and also the control seem to be disabled once I set the CommandStyle from csButton to csCombobox.
Please help.
I've never used the Ribbon before, but i made a little test and this is wath i get, I don't know if this is wath you want:
alt text http://img2.imageshack.us/img2/6885/ribboncombo.png
Just add strings to the Items property

Resources