PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → [WM20] Know the quantity of strings on a width of edit
[WM20] Know the quantity of strings on a width of edit
Débuté par ARV, 06 juin 2018 19:16 - 13 réponses
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 06 juin 2018 - 19:16
Hi

Like the title said, I need to know how many strings can be on a one line of the width, like for example

EDT_Text = 356 pixels
With that for said something on one line can be 50 letters of strings like if I´m using length(Text)


well I REALLY need to know if there's a way to know this on an edit.
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 06 juin 2018 - 19:29
Hi

the edit it's a multi-line text
Posté le 06 juin 2018 - 23:13
https://help.windev.com/en-US/…

On 6/6/2018 11:29 AM, Jose wrote:
Hi

the edit it's a multi-line text
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 07 juin 2018 - 18:02
Hi Fabrice

thanks! it work on a edit I will try with a table, they said only work for edit, combobox and list but I hope if this could work on a table

Thanks
Best Regards
Jose
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 07 juin 2018 - 19:23
Hi Fabrice

Yes it work with a table too.

Thanks for the help
Best Regards
Jose
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 07 juin 2018 - 19:56
Hi fabrice look

I need to know how to transform pixels to string something like

I know my text on that table occupied 41 pixels, and my table on that colum are 539 pixels if I do TotalOfPixelsForMyTextReachTheTable = 539 - 41
now I have 498 pixels to add to reach my colum of the table.

how Can I get the total of " " to add on my string to reach that colum of my table
Posté le 07 juin 2018 - 22:32
Hi Jose...

if it's all with the same char, get the width in pixel of " ", then
divide your remaining number of pixels by that value, and you have your
number

On 6/7/2018 11:56 AM, Jose wrote:
Hi fabrice look
I need to know how to transform pixels to string something like

I know my text on that table occupied 41 pixels, and my table on that
colum are 539 pixels if I do TotalOfPixelsForMyTextReachTheTable = 539 - 41
now I have 498 pixels to add to reach my colum of the table.

how Can I get the total of " " to add on my string to reach that colum
of my table
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 07 juin 2018 - 23:00
Hi

in other words I have a colum on a table, the text of the table is on the left I want to add some " " but I need to know how many I need to add, so I have the quantity on pixel but I need to know how many is on string not in pixel in other words how many " " I need to add on a colum of the table if all I can get it's on pixel.

Best regards
Jose
Posté le 08 juin 2018 - 12:34
In other words, I understood the question and answered it...

On 6/7/2018 3:00 PM, Jose wrote:
Hi

in other words I have a colum on a table, the text of the table is on
the left I want to add some " " but I need to know how many I need to
add, so I have the quantity on pixel but I need to know how many is on
string not in pixel in other words how many " " I need to add on a colum
of the table if all I can get it's on pixel.

Best regards
Jose
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 08 juin 2018 - 16:25
Hi Fabrice

Sorry I didn't see your answer and yes I know how many pixels its " " an it's 5 pixels, but when I do my math on this it get's so mess up like this






so I don't know man...



Thanks
Best Regards
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 08 juin 2018 - 16:31
HI

Also if the word it's not that big it gets something like this:





it doesn't add the " " because it's on the next line also I put an "." just to have the " " working and on the displaying row doesn't put an blank row for some reason.

Thanks
Best Regards
Jose
Posté le 08 juin 2018 - 17:39
it looks like your code is incorrect...

as usual, without SEEING your code, there is nothing anybody can do...

questions:

1. WHY are you trying to add spaces?
2. is your code taking into account the MULTILINE element?
3. REALLY, WHY? :-)

if it's to align left or right, you can change the style...

best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on http://www.fabriceharari.com


On 6/8/2018 8:31 AM, Jose wrote:
HI

Also if the word it's not that big it gets something like this:






it doesn't add the " " because it's on the next line also I put an "."
just to have the " " working and on the displaying row doesn't put an
blank row for some reason.

Thanks
Best Regards
Jose
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 08 juin 2018 - 22:04
Hi Fabrice

I'm doing this because I'm trying to create a chat LOL

But in the end I will not use a Table just for the problem of this, I want to use one column and then I add spaces just to simulate for the one who write it and the other that see what I write just to see a difference on the window, so in the end the style doesn't work on this on one column.

anyway I end using MultiZone and using edits and that's all.

for the code I was using for the table I end up using this:

rE,rPF is real
PTEE is real = TextWidth(TABLE_Chat[TABLE_Chat].COL_M,TABLE_Chat[TABLE_Chat].COL_M,tSingleLine)

rPF= (IntegerPart(PTEE/TABLE_Chat[TABLE_Chat].COL_M..Width)*TABLE_Chat[TABLE_Chat].COL_M..Width)-PTEE+TABLE_Chat[TABLE_Chat].COL_M..Width




rE = rPF / TextWidth(TABLE_Chat[TABLE_Chat].COL_M,".",tSingleLine)

FOR i = 1 _TO_ IntegerPart(rE-2)

TABLE_Chat[TABLE_Chat].COL_M = TABLE_Chat[TABLE_Chat].COL_M + "."
END
TABLE_Chat[TABLE_Chat].COL_M = TABLE_Chat[TABLE_Chat].COL_M + "."



In the end this code do the thing that I send to you on the image, in the end I change everything for a MultiZone, I only show you this just if you want to see it and have an idea if you want.

ALSO the column it's MultiLine Text and have auto wrap line.

Thanks
Best Regards
Jose
Message modifié, 08 juin 2018 - 22:05
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 08 juin 2018 - 22:09
Hi

I change my mind about all of this because it doesn't get on the right place I want to so I change everything on MultiZone aaannnndddd~ it's more easy to do.

Thanks for all of your answers Fabrice
Best Regards
Jose