How can I get the main text of CAknDoubleLargeStyleListBox control - symbian

I have a listbox control in symbian of type CAknDoubleLargeStyleListBox, and I want to get the selected item Main text, Not the icon index or the secondary text.How can I do that knowing that the item consists of "Icon Index \t Main Text \t Secondary Text"

The best way to do this is to manually parse the Descriptor.
TBufC<128> string = "Icon Index \t Main Text \t Secondary Text"
int firstSeparator = string.Find(_L("\t"));
int secondSeparator = string.Right( string.Length() - firstSeparator -2).Find(_L("\t"));
secondSeparator+= firstSeparator;
TBuf<128> mainString = string.Mid(firstSeparator,secondSeparator);
You might have to fine tune the code to eliminate compile errors.

Many thanks Abhijith for your help, I found also a great solution in symbian to do the job just in one line.
static IMPORT_C TInt ColumnText(TPtrC &aColumnText, TInt aColumn, const TDesC *aSourceText, TChar aColumnSeparator=KColumnListSeparator);
TextUtils::ColumnText(Returned Column,Column Number, Whole text, Delimiter)
More information could be found in Symbian S60 3rd Ed SDK.

Related

Keyboard shortcuts on Flutter web

I'm adding keyboard shortcuts to a Flutter web application.
I have a form within a custom FocusableActionDetector where the shortcut has form like this:
SingleActivator(LogicalKeyboardKey.digit2)
and action is like:
CustomActivateIntent: CallbackAction<CustomActivateIntent>(
onInvoke: (intent) { provider.value = "2"; },)
In the same form I have a couple of numeric TextFormFields. To permit writing the character "2" I have to put these text fields inside some new FocusableActionDetector, otherwise the previous detector catches the command and the text field loses the "2" character, and this is already quite weird... Moreover, after writing in any of the text fields the form focus detector doesn't work anymore.
I think this could be related to the focus system, which is yet not that clear to me.
Can anyone help find a clean solution?
I found a workaround: the FocusableActionDetector is now preceded by an if statement. The code looks like the following:
// I extract the form to a widget to make it clearer
var searchWidget = SearchWidget();
child: textEditingInProgress
? searchWidget
: FocusableActionDetector(
child: searchWidget,
...,
),
The textEditingInProgress bool is a field in a provider and is controlled by the FocusNodes belonging to the TextControllers.
Still this is not a perfect solution, in particular I'd like to understand why the previous approach was not working.

Birt export in pdf does not wordwrap long lines

My reports preview is ok.
But now, I need to export to pdf...and I've got an issue : the content of some cells are truncated to the witdh of the column.
For instance, 1 cell should display "BASELINE"...in the preview it's ok...but in pdf, it displays "BASEL".
I've been looking for a solution the whole day and did not find anything...
Of course : I don't want to fit the width of the column on the length of this word "BASELINE" because the content is dynamic...
Instead, I want to fix the column width and then, the cell should display something like that :
BASEL
INE
Any idea ?
Thanks in advance (am a little bit desperated...)
The solution is trivial in BIRT v4.9 if you've integrated the engine into your java code. Just set the PDF rendering options.
RenderOption options = new PDFRenderOption();
options.setOutputStream(out);
options.setOutputFormat("pdf");
options.setOption(PDFRenderOption.PDF_WORDBREAK, true);
options.setOption(PDFRenderOption.PDF_TEXT_WRAPPING, true);
task.setRenderOption(options);
You have to set a special PDF emitter option:
PDFRenderOption options = new PDFRenderOption();
options.setOption(PDFRenderOption.PDF_HYPHENATION, true);
This is if you integrated BIRT into your Java program.
For the viewer servlet, it is possible to set such options, too, AFAIK, but I don't know how; maybe on the URL or using environment variables.
I had the same issue. I found a very good topic about that : http://developer.actuate.com/community/forum/index.php?/topic/19827-how-do-i-use-word-wrap-in-report-design/?s=173b4ad992e47395e2c8b9070c2d3cce
This will split the string in the given number of character you want :
The function to add in a functions.js (for example). To let you know, I create some folder in my report project : one for the reports, one for the template, one for the libraries, another for the resources, I added this js file in the resources folder.
/**
* Format a long String to be smaller and be entirely showed
*
*#param longStr
* the String to split
*#param width
* the character number that the string should be
*
*#returns the string splited
*/
function wrap(longStr,width){
length = longStr.length;
if(length <= width)
return longStr;
return (longStr.substring(0, width) + "\n" + wrap(longStr.substring(width, length), width));
}
You will have to add this js file in the reports : in the properties -> Resources -> Javascript files
This is working for me.
Note: you can add this function in your data directly if you need only once...
The disadvantage of this : you will have to specify a max length for your character, you can have blank spaces in the column if you specify a number to small to fill the column.
But, this is the best way I found. Let me know if you find something else and if it's working.

Is there a keyboard shortcut to select a column for editing in Atom editor?

Scenario
When editing a file in Atom Editor how do I select multiple lines where the same edit needs to be performed?
For example:
this.name = name;
this.age = age;
this.sound = sound;
needs to be transformed into:
that.name = name;
that.age = age;
that.sound = sound;
Imagine there are many of these lines, but we do not want to use a find-and-replace because it will change more than we need.
Question - Is there a Keyboard Shortcut for Column Selection?
Is there a sequence of keyboard shortcuts (preferably Mac) which we can use to:
a) select the initial word
b) select the "column" (that word on several lines)
then apply the change to several lines at once (in bulk)
I know how to do this in SublimeText:
http://sublime-text-unofficial-documentation.readthedocs.org/en/latest/editing/editing.html#column-selection but have tried many different key combinations without any luck in Atom and googling has proved fruitless...
There are several ways to achieve this:
Keyboard
You can enable column selection mode using Ctrl+Shift+↑/↓. This will allow you to extend the cursor to multiple rows. Once you have selected all rows, release the keys, and use the Delete key to remove the text you want to replace. Once you're done, press the Esc key to release the cursors.
Note: You will have to disable the Mission Control (key bindings) in OS X to use this key combo.
How to Disable Mission Control (conflicting) Key Bindings (Mac)
To do this open System Preferences > Mission Control
Locate the key bindings for Mission Control and Applications windows:
Disable the key bindings for these two:
More details here.
Mouse
If you install the Sublime Style Column Selection package, you can use Alt+Mouse to select the columns in question.
More details here.
Here is a plugin for Atom, just hold alt and be happy.
sublime-style-column-selection
With the cursor somewhere on the first "this", do Ctrl+D (OS X: command+D) three times. Then type "that".
Another option is to select the rows you want to edit. Then select "Split into Lines" from the "selection" menu. Then hit the home-key and start editing away in multi-cursor mode.
For me on Atom 1.7.4 it worked by adding below lines to my /Users/username/.atom/keymap.cson. Ofcourse I am using alt-shift-down as shortcuts.
'atom-workspace atom-text-editor:not([mini])':
'alt-shift-down': 'editor:add-selection-below'
Update: I could not configure both alt+shift+down and alt+shift+up at the same time. For now I am okay with alt+shift+down
On Windows 10, follow the following steps:
Press ctrl + alt together and use up/down arrow keys to expand the height of your now vertical cursor
Now use shift to select the columns to be deleted
press delete key to remove selected columns
click anywhere on document (without pressing ctrl/alt keys) to bring cursor back to normal 1 column height
I came by this thread, and the feature I was personally looking for was the multi-cursor extension.
I've tried all of the following potential solutions:
sublime-style-column-selection
multi-cursor
multi-cursor-plus
Adding the following text to /Users/$(whoami)/.atom/leymap.cson
'atom-workspace atom-text-editor:not([mini])':
'alt-down': 'editor:add-selection-below'
'alt-up': 'editor:add-selection-above'
The last solution is the one that worked best without interfering with any of my other normal workflows.

what is the use of NSLocalizedString and when to use?

What is the use of NSLocalizedString?
self.textfiled.text=NSLocalizedString(#"testing", #"test")];
When i execute the same i got the textfield displayed only testing? What will be the use of second Parameter then??
I won't get into details but long story short, it is used for creating an application which will be shown in various languages. It is a macro that returns a string, according to the locale of the device. Let's assume you are writing an app which will have an english and turkish version. You need to have at least two different versions of localizable.strings file, one of English and one for Turkish. The format is the same for both:
/* Cancel button text */
"Cancel" = "Cancel";
and for TR:
/* Cancel button text */
"Cancel" = "İptal";
Note that the format is not "english" = "turkish", it is "key" = "value" in both versions. It will be created by genstrings if you provide an NSLocalizedString macro in your code such as:
NSLocalizedString(#"Cancel", #"Cancel button text")]
NSLocalizedString finds the localizable.strings version from the app bundle and loads the string according to the device's locale. Note that it wont help you change language during runtime; but it will change the app language if you go to settings, change locale and restart your app.
Second parameter will be used as a prompt to translators about context of string being used in your application. It will be added to file generated by genstring tool, output will be something like:
self.textfiled.text = NSLocalizedString(#"AboutUserKey", #"Title for about user button")];
...
// en/Localizable.string
/* Title for about user button */
"AboutUserKey" = "About";
// ru/Localizable.string
/* Title for about user button */
"AboutUserKey" = "О пользователе";

Fixed text when scrolling

My program displays an ABAP list, I'm trying to show a header (some lines of text, nothing fancy) fixed when scrolling down in a report.
Is there some kind of tag or declaration that I have to use?
In SE38 you can define list heading with 'GOTO -> Text Elements -> List Headings`.
You can define a list header, and titles for your list (Columns heading).
One advantage: With GOTO -> Translations you can define different texts in different languages.
Another way to get this maintenance screen:
From your list, you can choose: System -> List -> List Header.
Another way:
You can use top-of-page to define your header text inside your report code.
top-of-page.
write 'My header'.
You can use the TOP OF PAGE event to write something that will stick at the top of the page while scrolling. You can find more info here.
You can also use the list headers from Text Elements menu. More info here.
Best regards,
Sergiu
One way is directly using top-of-page in your code.
Other way is calling reuse_alv_grid_display or reuse_alv_list_display (depending on your output type) and declaring "top-of-page" in the I_CALLBACK_TOP_OF_PAGE line. Then create a sub-routine with the same name as your "top-of-page". In that you can write
wa_list-typ = 'H'.
wa_list-info = ''.
APPEND wa_list to it_list.
clear wa_list.
OR
wa_list-typ = 'A'.
wa_list-info = 'Report Header'.
APPEND wa_list to it_list.
clear wa_list.
OR
wa_list-typ = 'S'.
wa_list-info = 'Report Header'.
APPEND wa_list to it_list.
clear wa_list.
depending on what you want (header, action or selection).
Finally you can use REUSE_ALV_COMMENTARY_WRITE function and call the table(in this example it_list).
Hope it helped.