Is there a way to select/highlight a Date Range/series using Delphi 10.3 FMX TCalendar (Or a similar component)? - firemonkey

I am looking for a way to highlight a range of dates between a given start date and end date using a TCalendar in a Delphi 10.3 FMX application. It is for visual purposes as the client selects a start and end date in seperate TDateEdit components.
I have looked it up, but I can't seem to find anything that explains what I want to achieve. Does the TCalendar perhaps have a method that achieves this, or is there a possible work-around?
I hope that my question was clear.
Thank you in advance!

The TCalendar is a component that is setup with a model class, a component class, and a style class. There are multiple controls that work this way. I can write a lenghty answer about how all of this works, but when I first started exploring FMX I had to dig in this for myself and found een article by Yaroslavin Brovin about the topic. It's in Russian (some of it translated in not that well written English) so you have to use a translator if you aren't familiar with the language (such as me :)). Here is then website
Just thinking out loud here: What you can do is add a begin/end date prop to the model class en make your own derived style class where you can give the days you want to highlight your own preferred style through painting directly, or through styling via StyleBook.

Related

Generic Universal UI Format?

I'm not sure StackOverflow is the best StackExchange site for this but I can't find a general standards/architecture one, if StackOverflow isn't the best place for a question in this form please point me in the correct direction.
I'm trying to find a universal UI format, due to business constraints I can't get too far into the specific use case, but am looking for something which would function as a minimal UI format for calling API functions, displaying tabular or descriptive data, ideally with images and other binary formats included, and displaying regardless of unforeseeable future changes in tech.
Is vanilla HTML the best solution here, or is there a more base-level option around already?

How do you generally programm a language selection

I wanted to know from someone with field experience, what the best practice of implementing a programm, with UI or CMD in multiple languages (letting the user choose e.g. between English, French, German) is.
If there already exists a discussion about this topic I would be grateful, if somebody could send me a link to it, the first few Google searches I only found things like how to choose a programming language
The first options that came to my mind where switch(globalStringLanguage) and #ifdef GERMAN #define PROGRESS Fortschritt... .
Would really like to know, if there is a best practice out there(and which one that would be) and how you guys implement it in your firm.
Thanks in advance for the replies,
1973ProgrammingDude
There are 4 'best practices / topics' that you can research:-
i18n - internationalisation
This is more about the way you design software. You design buttons etc. to 'lookup' the text they should contain from a dictionary file rather than hard coding them into your source code.
It also applies to things like dates and currency and allow them to be formatted differently depending on the language / locale.
If you design your product correctly you should be able to change all the text on buttons, links etc. and change the date format, currency formatting etc. with one language variable being changed.
Think of this part as designing your system to account for translation, local formatting and even right to left layouts for languages such as Arabic that are read from the right to the left
l10n - localisation
This is the process that follows on from designing your system under i18n. You would define formatting options so dates etc. are correct.
You would also define wording of buttons etc. so they are correct.
Finally you would also have a system so that content could be translated for the given locale.
Think of this part as the actual translation process.
l12y - Localisability
pretty much covers the process and considerations of l10n - just mentioned so you can research it for more complex scenarios and implementation ideas.
g11n - Globalisation
Encompasses all of the above standards, yet again just mentioned for reference as it occasionally throws up some different articles on Google when searching on how to solve a particular problem.
Quick sanity checks
When designing a system that supports glln it easier to have a couple of points to help make you think about decisions you are making.
If you enter ANY plain text within HTML tags / controls / whatever is applicable to your chosen programming language then you will likely have made a mistake. Every item of plain text should be programmatically inserted into a page.
Design a dictionary system - for every piece of plain text you want to add to the site add it to a dictionary. The dictionary can be a simple key:value list if you need with the key being the English translation and the Value being the translation for your locale. Make sure that you start with English:English translations so you can make sure you don't miss any. I would recommend JSON arrays as most translation companies will now understand how to use these nowadays without you needing to design a user interface for them.
When designing a widget / component consider implications of longer text - just because a layout works in English (i.e. a button group fits on one line) doesn't mean it will work in another. Some languages may be 3 times longer for the translation of a word so you must consider this when designing a layout.
Everything should be designed so it can easily be reversed. Right To Left versions of everything should be easy to implement so design your system so only a couple of variables need changing to create the RTL version. (i.e. if web based have a main CSS definition of a widget and then make sure a global CSS class applied to the body can switch the layout).
It isn't just text -> imagery needs to be different as different cultures will interpret an image differently. Also iconography should be internationalised as well as a dollar bill icon doesn't work well to represent money in the UK, never mind in other countries.
CSS Example but the principle applies to all languages / platforms
.widget{
//define general styles
}
.left-to-right .widget{
//add some formatting to adjust layout for left-to-right languages such as English when the 'left-to-right' global variable is set.
margin-left: 20px;
}
.right-to-left .widget{
//add some formatting to adjust layout for right-to-left languages such as Arabic when the 'right-to-left' global variable is set.
margin-right: 0px;
}

UI library for Windows Mobile 6

I need some help finding a graphic library for Windows Mobile 6 with a control to answer some quick Yes/No questions.
Something like what's shown here
Also, I need to do something like this.
I don't need to present it the information in the exact same way but that would definitively be a plus.
Thank you very much in advance. Any help will be appreciated.
The way I did it at the end was how josef said, I wrote my own control for the Yes/No answers and I designed a static class to draw over a predefined image with the format already stablished (I just draw the lines indicating what the driving did at a particular time)

Image/form to Pascal/Delphi code converter?

Does anyone knows about any editor allowing to visually design a form (by form I do not mean DFM or Delphi form, but a "paper form", like those pre-printed forms that you fill with some info) and that generates pascal commands to draw that form in a Printer (or Image) canvas?
What I want is an easy way to draw/design this form visually, composed just by lines and text, and a way to convert this to Pascal commands that when run, will draw that form in a Canvas (Image or Printer), respecting the original layout and scale, doesn't matter the Canvas DPI where it is being drawn.
Update: Maybe I wasn't clear enough about what I need and why I need it. I developed an Open Source component called TFreeBoleto (freeboleto.sf.net). It is used to generate and print bank billets (a common method for billing people in Brazil). Right now, the component uses a TBitmap image containing the "billet" mask, and TextOut methods for the dynamic areas (ie: billet number, customer name, etc). It is fine when looked in the screen, but some people complains that the quality of the printed image is not good. The component uses a BltTBitmapAsDib procedure to maximize the quality of printing, but some people still think it is not good enough. So, my idea was to avoid using a bitmap image as the form layout, and draw everything direct in the canvas (both form and printer). Check here for a sample of what a bank billet looks like.
Of course ReportBuilder and/or FastReport could solve the problem, but they are not free, so I cannot include it in the component. I need "native" solution that any standard Delphi install would be able to compile.
You might get what you want out of the Fast Reports Report Designer which is a commercial reporting system for Delphi. Remember that a report is just a page. That page can be shown on the screen or printed on the printer.
You also might find that something like TRichView helps you.
Whether using TRichView in particular or not, I would look into using HTML to do what you want. I would use HTML+CSS to do both a screen and printer layout, that can also be viewed on the web. For simple text layout plus text boxes I think even bare HTML and HTML tables might be sufficient. To visually design simple text pages, using a Delphi application, I would use TRichView.
In both cases, you would be creating documents, not code. To create code that creates a page, without using any document system, would be very difficult indeed, and I am not sure what you would really do with that code, since you would need a compiler or interpreter to convert that code into something that you could use. Please clarify what you mean by "creating code", and what syntax you would want that code to be using. If HTML is code in your definition of "code" then maybe HTML is the best kind of "code" for your problem.
I do my form-work with WPTools. It is also a commercial product. The core is a very good wordprocessor and form-designer. The engine can render text and forms to any canvas (screen, printer, also create pdf) and is highly flexible. Output is mainly rtf and html.
I also see no advantage in creating pascal code to redraw the form. What you need, i think, is a good WYSIWYG-editor which creates a document that fits your needs.
Check out ReportBuilder # http://www.digital-metaphors.com/
It is a commercial reporting tool for Delphi - around a long time, very high quality, with all native Delphi source code packaged with it. I am using it for an important commercial project right now and I recommend it highly (I'm not working for them.) I've used MANY Delphi reporting tools over the years and this one is the best IMO.
RBuilder also has extensive support for paper form emulation see:
http://www.digital-metaphors.com/products/report_design/form_emulation.html
I haven't worked with that feature, but you can download a full-featured demo and try it.
Yoy can use Adobe Acrobat (full version) to create forms.
Then you can use free Acrobat Reader to display and print forms or other COM object in your application.
I think it is best solution for you.
PS
All tools for reports that are included in Delphi are free for you to design form and are free to distribute if user only preview and print already designed reports.
The same is valid for Adobe Acrobat (you may distribute forms) but you have added that you need to print form and some text over form. Maybe it is easier if you use reports but it is possible to do the same using PDF.
Most report engines are not open source but are free to distribute. There is many components for creating PDF - paid (one time), free, as well as open source.
PPS
I have read your updete for second time. Since you are using TBitmap and you can to TextOut so: You can use TMetafile. There is many editors for metafiles and it is free to distribute metafiles.

Chat Bubble Cocoa

I have been trying to create a chat bubble for about a month now... (you know, like the one in iChat or Tweetie). At some point I found a thread that said that I could use Twitterfon's source... which I did. But I get stuck for a few reasons. Which ones? Apple didn't seem to implement all the methods needed for calculating the rect's size. E.g.: NSTextField doesn't implement a method that allows me to give an NSRect in order for it to calculate the best size. The fact is, Tweetie's bubble rects are always perfect. I dropped him a line asking how he did that, but I didn't get a reply. Although, I understand, because it is used in a commercial application. I thought that with the popularity of iPhone's SMS application (and iChat, or any app including chat bubbles), someone would probably made an implementation on OS X, and made it open source. I am not very experienced, and mainly I don't have time (school), so this is why I have been working on it for one month and have not found a solution.
If someone created the thing on Cocoa, would they please explain their solution for it ? Or even better, show some code...
The AppKit NSString Additions have methods to measure strings for drawing, and for more advanced purposes you can use NSLayoutManager. See the Text Layout Programming Guide for more info.
Alternatively you could use WebKit and HTML/CSS. I believe this is how Adium achieve their IM message themes.
Check out the BubbleThingie sample code for example of how to do the image masking. It also has example of how to do the text bubbles using a UIButton or UILabel and does all the size calculations. it also allows to tint the bubbles any color.

Resources