Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Text truncation

I am displaying text in a popup initiated by a hover.
This works fine on all PCs except 1, which has been no problem to date until this was reported today.

See screenshot where you see the 'Appointment' popup where there is
R...
0...
the text should be:
RDO
07:00am to 05:00pm

The popup has been sized correctly to show the text in full

Is there any reason you can think of for this to happen on only 1 PC?
Any ideas on possible cause.?

Comments

  • Barry,

    Are you changing the font property of the item? Perhaps intentionally or unintentionally.

    I had a similar symptom with prompts for the subclass control some time ago. Turned out I was changing the font to zero in an 'else' statement. I initially thought I was only changing the font if I wanted something other than the default and 'else' leaving the property as null but instead of null I was actually setting it to zero.

    All my prompts within editfields were then displaying the same as your items here; just the first letter and an ellipsis despite ample space for the contents.

    I know it's a different control but maybe something to look at anyway.

    My post about it before I realised it was my error is here:
    https://forum.srpcs.com/discussion/60/prompts-not-displaying#latest

  • I have just checked my dev and I am getting the same thing. Was working last checked.

    The only difference between My PC, the user PC with error and Other PCs is that My PC and User error PC have both unregistered and registered the new SRPControls.OCX
  • Barry,

    Is the code you use to build the SRP Popup using logic that creates Items of a fixed width or do you calculate the width dynamically based on some formula?
  • Yes, calculate the width dynamically based on some formula

    Unistalled the SRPControl.ocx and reinstalled the old controls and it works.
  • I added 100 more pixels to the with and still get the X...
  • I'm confused. I thought you reported that "it works" after reinstalling SRPControls.ocx.
  • here is my code warts and all that is exectued on the hover.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    ShowBalloonTip:
     
        // close the popup immediately
        Send_Message(@Window:".OLE_POPUP", "OLE.Close")
             
        SelPos=param2
        swap ';' with @fm in SelPos
        Col=SelPos<1>
        Row=SelPos<2>
        if Col=0 or Col=1 or Row=0 then return
        CellData = get_property(TableValues$,"OLE.CellText[":param2:"]")
        ToolTip=field(CellData,"|",2)
         
         
        if ToolTip then
            /*
            swap '~' with @fm in ToolTip
            ToolTip<3> = 1
            ToolTip<4> = 5000
            rv = Send_Message(Table$, "OLE.ShowBalloonTooltip", Col:@fm:Row, ToolTip)
        */
             
            Items=null$
            swap '~' with @fm in ToolTip
            Values=ToolTip<1>
            swap @tm with @vm in Values
            cnt=count(Values,@vm)+1
            CharCnt=0
            MaxPixels=null$
            for x=1 to cnt
                str=Values<0,x>
    *           len=len(Str)
    *           if len > CharCnt then CharCnt = len
                TextRecParam=Str
                TextRecParam<4>="Tahoma":@SVM:"":@SVM:"300":@SVM:"0":@SVM:"0" 
                Pixels=utility("TEXTRECT",'',str)
                if Pixels<1> > MaxPixels<1> then MaxPixels=Pixels
                *if not(index(str,'\',1)) then str=fmt(str,"T#25")
                *str=fmt(str,"T#30")
                *Values<0,x>=str
            next x
            *swap @vm with @tm in Values
    *       loop while Values
    *           Value=values[1,@tm]
    *           values[1,col2()]=null$
    *           Items<-1,2>=  value
    *       repeat
     
            CharCntDiv=int(CharCnt/10)
            CharCnt-=CharCntDiv
            PixelsWide=MaxPixels<1>+100
    *       if @station[1,7]="PAR-007" then PixelsWide+=3
    *       if @station[1,11]="BARRY_NEWPC" then PixelsWide+=3
             
            spacing=3
            PopHigh=0
            *Left=18;Top=1;Width=CharCnt*8;Height=12
            Left=18;Top=1;Width=PixelsWide;Height=12
            ItemsFmPos=1
            // need a heading//
            Items<ItemsFmPos,1>=0:@SVM:Top:@SVM:Width:@SVM:20
             
            Items<ItemsFmPos,2>=  ToolTip<2>:" "
            ColorFill = "Vertical(Gradient(DeepSkyBlue L=90, DeepSkyBlue L=80, 30%), Gradient(DeepSkyBlue L=75, DeepSkyBlue L=80), Border(Blue), Margin(0), Rounded(20))"
             
            Items<ItemsFmPos,3,2>="DeepSkyBlue"
            Items<ItemsFmPos,4> = "Tahoma":@SVM:"":@SVM:"700":@SVM:"1":@SVM:"0" 
            Items<ItemsFmPos,5>=  "Center"
              
            Top+=20
            loop while Values
                Value=values[1,@vm]
                values[1,col2()]=null$
                ItemsFmPos+=1
                if index(Value,@tm,1) then
                    loop while Value
                        WrapText=value[1,@tm]
                        value[1,col2()]=null$
                        ItemsFmPos+=1
                        Items<ItemsFmPos,1>=Left:@SVM:Top:@SVM:Width:@SVM:Height
                        Items<ItemsFmPos,2>=  WrapText
                        Items<ItemsFmPos,5>=  "Left"
                        Top+=Height-1
                    repeat
                    Top-=Height
                end else
                 
                    Items<ItemsFmPos,1>=Left:@SVM:Top:@SVM:Width:@SVM:Height
                    Items<ItemsFmPos,2>=  value
                    Items<ItemsFmPos,5>=  "Left"
                end
                Top+=Height+spacing
            repeat
            Set_Property(@Window:".OLE_POPUP", "OLE.Size", "":@fm:"":@FM:Width:@FM:Top)
             
            // Set a single centered text item in the popup
    *        Items = "" 
    *        Items<1, 1> = "0":@SVM:"0":@SVM:"170":@SVM:"130" 
    *        Items<1, 2> = "Hello, World!" 
    *        Items<1, 4> = "":@SVM:"":@SVM:"700":@SVM:"0":@SVM:"0" 
             *Items<1, 5> = "Center":@SVM:"Center" 
            Set_Property(@Window:".OLE_POPUP", "OLE.ItemList", Items)
            *Set_Property(@Window:".OLE_POPUP", "OLE.ItemList", Items)
             
            // Position the popup
            // Get the size of cell
            Size = Send_Message(Table$, "OLE.GetCellRect", Col:@FM:Row)
            X=Size<1>+Size<3>+12
            Y=Size<2>
                 
            HeaderCellSize=19
            Y+=HeaderCellSize*3
            gosub GetXY
             
             
            Send_Message(@Window:".OLE_POPUP", "OLE.ShowAt", x, y)
             
            *rv = Send_Message(@Window:".OLE_POPUP", "OLE.AboutBox")
        end
    return
  • Sorry Don about the shorthand.
    I put it back to SRPControl in my dev copy to try and sort out the problem.
    I dont regard putting back the old controls a fix.
  • Barry,

    My mistake. I misread your post. I thought you reinstalled the same control. I now see that you reinstalled an older control. We'll review your code and let you know what we come up with.
  • Thank you birthday boy!
  • It seems that you are using the same variable, Width, for the SRP Popup and the individual items. So, that suggests the widths of everything ought to be correct. So, on the surface this does appear to be a legitimate problem.

    Yet, I cannot easily figure out the problem without more information. Would you be willing to put a debug after ItemList property call and take a screen shot of the Items variable? That would be the easiest way for me to examine the final result and attempt to duplicate this on my end.
  • edited February 2016
    Here it is
  • what is showing for the above
  • Barry,

    What happens if you put font information for all items? I know there is supposed to be a default, but I want to confirm that specifying a font will avoid the problem.
  • still the same

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    loop while Values
                Value=values[1,@vm]
                values[1,col2()]=null$
                ItemsFmPos+=1
                if index(Value,@tm,1) then
                    loop while Value
                        WrapText=value[1,@tm]
                        value[1,col2()]=null$
                        ItemsFmPos+=1
                        Items<ItemsFmPos,1>=Left:@SVM:Top:@SVM:Width:@SVM:Height
                        Items<ItemsFmPos,2>=  WrapText
                        Items<ItemsFmPos,4> = "Tahoma":@SVM:"8":@SVM:"400":@SVM:"0":@SVM:"0" 
                        Items<ItemsFmPos,5>=  "Left"
                        Top+=Height-1
                    repeat
                    Top-=Height
                end else
                 
                    Items<ItemsFmPos,1>=Left:@SVM:Top:@SVM:Width:@SVM:Height
                    Items<ItemsFmPos,2>=  value
                    Items<ItemsFmPos,4> = "Tahoma":@SVM:"8":@SVM:"400":@SVM:"0":@SVM:"0" 
                    Items<ItemsFmPos,5>=  "Left"
                end
                Top+=Height+spacing
            repeat
  • Barry,

    I was able to duplicate your results. However, I discovered a way to resolve the problem. I cannot verify that this is a problem introduced with the latest SRPControls.ocx, but I don't have a reason to think this is a mistake.

    I was able to get the text to display properly when I increased the height of each item from 12 to 13. I suspect this is a font rendering issue and somehow the newer control is clipping the text in such a way that it thinks it needs to truncate the text.

    We'll take a closer look at the internal code to see if this needs more attention, but I would like to suggest that you try to increase the height through your code and see if that gets you by.
  • Yes Don, that fixed it
Sign In or Register to comment.