How to set Edittext to multiline? - android-edittext

I tried setting my EditText to multiline once and it worked. But when I changed some stuff on the EditText to make it look a bit cool, it doesn't type in multiline anymore.
<EditText
android:ems="10"
android:inputType="textMultiLine"
android:text=" "
android:id="#+id/reqdesc"
android:layout_width="fill_parent"
android:layout_height="110dp"
android:hint=" Enter your request here"
android:textSize="18sp"
android:maxLength="80"
android:background="#layout/rounded_border_edittext"
android:lines="8"
android:minLines="2"
android:gravity="top|left"
android:maxLines="4"
android:layout_marginTop="14dp"
android:layout_below="#+id/post"
android:layout_alignParentStart="true" />

reqdesc = (EditText) myView.findViewById(R.id.reqdesc);
reqdesc.setInputType(InputType.TYPE_CLASS_TEXT |
InputType.TYPE_TEXT_FLAG_MULTI_LINE |
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
InputFilter[] fArray = new InputFilter[1];
fArray[0] = new InputFilter.LengthFilter(maxLength);
reqdesc.setFilters(fArray);
It now works, I put these lines of codes under onCreate.

try this:
Find your Edittext
etReqdesc = (EditText) findViewById(R.id.reqdesc);
Now programetically call: inside onCreate()
etReqdesc.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
etReqdesc.setSingleLine(false);
etReqdesc.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
your edittext should look like:
<EditText
android:ems="10"
android:inputType="textMultiLine"
android:text=" "
android:id="#+id/reqdesc"
android:layout_width="fill_parent"
android:layout_height="110dp"
android:hint=" Enter your request here"
android:textSize="18sp"
android:background="#layout/rounded_border_edittext"
android:gravity="top|left"
android:layout_marginTop="14dp"
android:layout_below="#+id/post"
android:layout_alignParentStart="true" />
Remove android:maxLength="80" attribute.

Related

replace all double quotes with nothing in csv file in BIML script

I am importing flatfile connections using BIML.
" is used around text and ; is used as delimiter.
However, in some of the files I see this:
;"this is valid text""";
There are double double quotes with nothing between them. If I edit the file and search & replace all double double quotes with nothing, the import runs well. So, is it in BIML possible to do this action automagically? Search al instances of "" and replace these with ?
<#
string[] myFiles = Directory.GetFiles(path, extension);
string[] myColumns;
// Loop trough the files
int TableCount = 0;
foreach (string filePath in myFiles)
{
TableCount++;
fileName = Path.GetFileNameWithoutExtension(filePath);
#>
<Package Name="stg_<#=prefix#>_<#=TableCount.ToString()#>_<#=fileName#>" ConstraintMode="Linear" AutoCreateConfigurationsType="None" ProtectionLevel="<#=protectionlevel#>" PackagePassword="<#=packagepassword#>">
<Variables>
<Variable Name="CountStage" DataType="Int32" Namespace="User">0</Variable>
</Variables>
<Tasks>
<ExecuteSQL ConnectionName="STG_<#=application#>" Name="SQL-Truncate <#=fileName#>">
<DirectInput>TRUNCATE TABLE <#=dest_schema#>.<#=fileName#></DirectInput>
</ExecuteSQL>
<Dataflow Name="DFT-Transport CSV_<#=fileName#>">
<Transformations>
<FlatFileSource Name="SRC_FF-<#=fileName#> " ConnectionName="FF_CSV-<#=Path.GetFileNameWithoutExtension(filePath)#>">
</FlatFileSource>
<OleDbDestination ConnectionName="STG_<#=application#>" Name="OLE_DST-<#=fileName#>" >
<ExternalTableOutput Table="<#=dest_schema#>.<#=fileName#>"/>
</OleDbDestination>
</Transformations>
</Dataflow>
</Tasks>
</Package>
<# } #>
Turns out I was looking completely at the wrong place for this.
Went to the part where the file is read and added .Replace("\"\"","")
myColumns = myFile.ReadLine().Replace("""","").Replace(separator,"").Split(delimiter);

Flow Document Paper Size

I an trying to make a flow document and print with, I was able to adjust the data to required size, and I am getting the required output.
Below is the code for my Flow Document:
<Window x:Class="test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="test" Height="600" Width="500">
<Grid>
<FlowDocumentReader Width="330" Height="110" Name="DocumentRdr">
<FlowDocument FontSize="8" Name="Document" >
<Paragraph Margin="0">
<TextBlock Text="Brand:"/>
<Run Text="{Binding Brand}" />
</Paragraph>
<Paragraph Margin="0">
<TextBlock Text="Item:"/>
<Run Text="{Binding Cat1}" />
<TextBlock Text="Size:"/>
<Run Text="{Binding Size}" />
</Paragraph>
<Paragraph Margin="0">
Welcome
<Run Text="{Binding Brand}" />
</Paragraph>
<BlockUIContainer Margin="0">
<Image Source="{Binding BarCode}" Width="Auto" Height="Auto" Stretch="None" HorizontalAlignment="Left" />
</BlockUIContainer>
</FlowDocument>
</FlowDocumentReader>
</Grid>
</Window>
and the code I use for printing is as follows:
Dim data As New SampleData With {.Brand = "Some Brand", .Cat1 = "A Cat 1", .Size = "100-120"}
Dim k As Zen.Barcode.BarcodeDraw = Zen.Barcode.BarcodeDrawFactory.Code25InterleavedWithoutChecksum
Dim ms As New MemoryStream
k.Draw("1234", 25).Save(ms, System.Drawing.Imaging.ImageFormat.Png)
ms.Position = 0
Dim bi As New BitmapImage
bi.BeginInit()
bi.StreamSource = ms
bi.EndInit()
data.BarCode = bi
Dim temp As New test
temp.DataContext = data
Dim doc = temp.Document
doc.PageHeight = 110
Dim pd = New PrintDialog()
Dim dps As IDocumentPaginatorSource = doc
dps.DocumentPaginator.PageSize = New Windows.Size(100, 100)
If pd.ShowDialog() = True Then
dps.DocumentPaginator.PageSize = New Windows.Size(330, 110)
pd.PrintDocument(dps.DocumentPaginator, "Document")
End If
The Problem is, the text and image every thing comes in the size I want, but I am not able to change the size of the paper. I am trying to print labels, due to long page I am getting a print for every 10-12 labels, I want to change the paper size.
This print dialog is part of system.windows.control and not system.drawings.printing. I tied to change the code by keeping required size in every place in code where there is size, but not able to do. Could you please correct me, where I went wrong.
Tried the below code too:
pd.PrintQueue.DefaultPrintTicket.PageMediaSize = New System.Printing.PageMediaSize(10, 10)

hyperlink in openerp tree view

I want to add a link with ftp url in my tree view. i tested with adding widget="url" in my xml ,but its not working.
Please help
my code is
<tree string="File Names" >
<field name="time_created" string="Time Created"/>
<field name="size" string="Size"/>
<field name="file_name"/>
<field name="file_path" widget="url"/>
</tree>
class filedata(osv.osv):
_name = 'filedata'
_log_access = False
_columns = {
'file_name' : fields.char('Name'),
'file_path' : fields.char('File Path'),
'time_created' : fields.datetime('Date Time'),
'size' : fields.char('Size')
}
download this module and you can get clear idea of putting link in tree view. Hope this will help you.
https://www.openerp.com/apps/6.1/web_url/

Parse Xml tags with attributes

I have this xml :
<document-display>
<name>
<entry lang="nl">nl Text</entry>
<entry lang="fr">fr Text</entry>
<entry lang="en">en Text</entry>
</name>
</document-display>
I would like to get the text according to the langage.
I'm using XmlSlurper.
With my current code :
def parsedD = new XmlSlurper().parse(xml)
parsedD."document-display".name.entry.each {it.#lang == 'fr'}
I have as bad result which is the concatenation of the 3 text content :
nl Textfr Texten Text
Thanks for helping.
Try
parsedD.name.entry.find { it.#lang == 'fr' }?.text()

new line for tooltip fetching values from the database

$price = mysql_result($result, $num, "drinks_shot"); $price2 = mysql_result($result, $num, "drinks_bottle");
$append = $clean_name.'<br> Per shot: Php'.$price.'<br> Per bottle: Php'.$price2.'.00'; $description = mysql_result($result, $num, "drinks_image"); echo "<td class='label'><img src='". mysql_result($result, $num, 'drinks_image')."' onclick='addtocart(". mysql_result($result, $num, 'drinks_id').")' class='masterTooltip' title= '".$append."'<br>";
if only i could make it display like
hennessy
price1
price2
i found similar posts regarding my problem but none of them are really working. Please help. :(
You want linebreaks inside a title="" tooltip? Instead of using <br>, use \n and make sure it's inside double (") quotes and not single quotes. Like so:
$append = $clean_name . "\n Per shot: Php" . $price . "\n ...";

Resources