locked
LDShapes.Width () RRS feed

  • Question

  • Help to understand!

    Here is the code:

    Week = Clock.WeekDay 
    ShWeek = Shapes.addText (Week) 
    WhShape = LDShapes.Width (ShWeek)        ' width in pixels
    WhShape = WhShape / 2                           ' width / 2
    GraphicsWindow.ShowMessage (WhShape,0)

    Can't convert text to numbers. Programme Returns - 0

    Why ?

    Monday, November 28, 2016 2:17 PM

Answers

  • Use the following:

    WhShape = LDUtilities.GetCultureInvariantNumber(LDShapes.Width (ShWeek))

    The error is caused by the European use of a comma in numbers.


    Jan [ WhTurner ] The Netherlands

    Monday, November 28, 2016 4:16 PM
    Answerer

All replies

  • Hi Dimitry !

    first , using Bing Translator, i have your request in English, it look like this:

                              
    Помогите разобраться!
    Вот код:
    Help me understand!
    Here is the code:

    Как сделать так, чтобы WhShape возвращала верный результат.
    Не могу преобразовать текст в цифры.
    Что-то я совсем запутался.

    How to make WhShape return a correct result.
    Can't convert text to numbers.

    Something I am quite confused.

    Like this , your program works !   -   Как это ваша программа работает!

    _______________________________________________________________________________

    shweek = Shapes.AddText("")
    Week = Clock.WeekDay 
    date = clock.date

    Shapes.SetText(shweek,week+" "+date) 
    GraphicsWindow.ShowMessage (week,"день недели")

    _______________________________________________________________________________

    Monday, November 28, 2016 2:39 PM
    Answerer
  • did not see where you use the solution WhShape = LDShapes.Width (ShWeek)

    I need to know the width of the text and divide it in half.

    Monday, November 28, 2016 3:40 PM
  • Use the following:

    WhShape = LDUtilities.GetCultureInvariantNumber(LDShapes.Width (ShWeek))

    The error is caused by the European use of a comma in numbers.


    Jan [ WhTurner ] The Netherlands

    Monday, November 28, 2016 4:16 PM
    Answerer
  • СПАСИБО !
    Monday, November 28, 2016 4:54 PM