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.?
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
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
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
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?
Unistalled the SRPControl.ocx and reinstalled the old controls and it works.
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
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.
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.
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.
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.
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
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.