WebGadget table nowrap ellipsis

Anfängerfragen zum Programmieren mit PureBasic.
Benutzeravatar
marcelx
Beiträge: 429
Registriert: 19.02.2010 20:19
Wohnort: Darmstadt

WebGadget table nowrap ellipsis

Beitrag von marcelx »

Hallo,

ich möchte in eine WebGadget eine HTML-Tabelle mit feste Spaltenbreite darstellen.
Der Text darf nur auf eine Zeile angezeigt werden (white-space: nowrap).
Wenn der Text zu lang ist, sollte gekappt werden (overflow: hidden; text-overflow: ellipsis;)

Leider funktioniert nicht so wie gewollt.
Wenn ich die Leerzeichen in der Datei mit z.B. _ ersetzt, funktioniert gut.
Mit "white-space: nowrap" müsste gehen.

Code: Alles auswählen

Enumeration
  #myWindow
EndEnumeration
Enumeration
  #myWebGadget
EndEnumeration

Procedure.s ReadHTML()
  fichier.s = OpenFileRequester("Please choose file to load", "c:\","*.*|*.*", 0)
  If ReadFile(0, fichier)  ; txt-file
    While Eof(0)=0
      Texte$ = Texte$+ReadString(0)+Chr(13)+Chr(10)
    Wend
    CloseFile(0)
  Else
    MessageRequester("Message", "Erreur", 0)
  EndIf
  ProcedureReturn Texte$
EndProcedure

OpenWindow(#myWindow, #PB_Any, #PB_Any, 800, 615, "")

WebGadget(#myWebGadget, 5, 35, 790, 250, "")

HTML.s = ReadHTML()

SetGadgetItemText(#myWebGadget, #PB_Web_HtmlCode, HTML)

Repeat
  EventW = WaitWindowEvent()
Until eventW = #PB_Event_CloseWindow
HTML-Datei:

Code: Alles auswählen

<html>
<head>
<title>test</title>
<style>
#col1 { width: 120px; }
#col2 { width: 150px; }

table, th, td {border: 1px solid black; }
table {border-collapse: collapse; white-space: nowrap; 
table-layout: fixed; border:1; width: 270px;}
th, td {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}

</style>
</head>

<body>
<table>
  <col id="col1">
  <col id="col2">
  <thead>
    <tr>
      <th>1This cells has more content zz|</th>
      <th>column 2XXXzzzz fffddd|</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>1.1This cells has more content|</td>
      <td>1\2 qwert asdfg xcvb|</td>
    </tr>
  </tbody>
</table>
</body>
</html>

NACHTRAG:
Mit FF wird die HTML-Datei richtig dargestellt.
Liegt es an WebGadget ?

Danke
MarcelX
Win-10, PB 5.31 (Windows - x86)
Benutzeravatar
DarkSoul
Beiträge: 689
Registriert: 19.10.2006 12:51

Re: WebGadget table nowrap ellipsis

Beitrag von DarkSoul »

Habe jetzt grad kein Windows parrat. Wird ein typisches IE-Problem sein...

Könntest versuchen, die Whitespaces durch "&nbsp;" zu ersetzen, so dass im Grunde ein einziges, ganz langes Wort entsteht. Der &nbsp; ist extra dafür gedacht. :allright:

Dann sollte der overflow:hidden im CSS für das Kappen sorgen. :)
Bild
Benutzeravatar
marcelx
Beiträge: 429
Registriert: 19.02.2010 20:19
Wohnort: Darmstadt

Re: WebGadget table nowrap ellipsis

Beitrag von marcelx »

Danke DarkSoul,

so funktionniert mit &nbsp;

Super
Win-10, PB 5.31 (Windows - x86)
Benutzeravatar
udg
Beiträge: 566
Registriert: 20.06.2013 23:27

Re: WebGadget table nowrap ellipsis

Beitrag von udg »

Deine HTML habe ich mit folgenden Browsern getestet:
Bild Bild Bild

Überall gleich, funktioniert.

Dein Code:
Bild

Geht.
Das Webgadget bedient sich dem InternetExplorer.

was geht bei dir nicht?
PB v5.43 LTS + v6.02 LTS | Windows 7 x86 + 11 x64 - Gforce RTX 4090 - AMD Ryzen 9 5900X 12-Core Processor 4.2 GHz - 64,0 GB RAM,
ASUSTEK TUF Gaming X570 Plus
ASUS ROG Thor-1200P Platinum (1200W, Aura Sync, OLED Display, 0dB-Cooling)
1x 1 TByte Samsung MZ-V7S500BW 970 EVO Plus 1 TB NVMe M.2 Internal SSD
1x 2 TByte Samsung MZ-V7S2T0BW 970 EVO Plus 2 TB NVMe M.2 Internal SSD
von BiSONTE!. Kauft Hardware gern bei ihm.
Monitor:
LG 38GL950G-B 95 (38 Zoll) Ultragear Curved 21: 9 UltraWide QHD IPS
Benutzeravatar
marcelx
Beiträge: 429
Registriert: 19.02.2010 20:19
Wohnort: Darmstadt

Re: WebGadget table nowrap ellipsis

Beitrag von marcelx »

was geht bei dir nicht?
wenn Leerzeichen oder z.B. \ vorkommt, wird alles auf mehrere Zeilen komplett dargestellt.

Ich verwende WebGadget für Druckvorschau mit WebObject\ExecWB(#OLECMDID_PRINTPREVIEW...
Window 7, IE 11
Win-10, PB 5.31 (Windows - x86)
Benutzeravatar
marcelx
Beiträge: 429
Registriert: 19.02.2010 20:19
Wohnort: Darmstadt

Re: WebGadget table nowrap ellipsis

Beitrag von marcelx »

Bei mir sieht es so aus:
Bild
Win-10, PB 5.31 (Windows - x86)
Benutzeravatar
udg
Beiträge: 566
Registriert: 20.06.2013 23:27

Re: WebGadget table nowrap ellipsis

Beitrag von udg »

merkwürdig. bei mir gehts.
PB v5.30 = geht
PB v5.43 LTS = geht
PB v5.43 LTS + v6.02 LTS | Windows 7 x86 + 11 x64 - Gforce RTX 4090 - AMD Ryzen 9 5900X 12-Core Processor 4.2 GHz - 64,0 GB RAM,
ASUSTEK TUF Gaming X570 Plus
ASUS ROG Thor-1200P Platinum (1200W, Aura Sync, OLED Display, 0dB-Cooling)
1x 1 TByte Samsung MZ-V7S500BW 970 EVO Plus 1 TB NVMe M.2 Internal SSD
1x 2 TByte Samsung MZ-V7S2T0BW 970 EVO Plus 2 TB NVMe M.2 Internal SSD
von BiSONTE!. Kauft Hardware gern bei ihm.
Monitor:
LG 38GL950G-B 95 (38 Zoll) Ultragear Curved 21: 9 UltraWide QHD IPS
Benutzeravatar
TroaX
Beiträge: 684
Registriert: 08.03.2013 14:27
Computerausstattung: PC: Ryzen 9 3950X, 96 GB RAM, RX6800XT, 2.5 TB SSD, 21:9 Display, Linux Mint | Lappi: Ryzen 7 5800H, 16 GB RAM, 1 TB SSD, Linux Mint
Wohnort: NRW
Kontaktdaten:

Re: WebGadget table nowrap ellipsis

Beitrag von TroaX »

Es liegt an der Version des ActiveX-Controls.

Zur Demonstration: Ändere mal in deiner HTML folgende Zeile:

Code: Alles auswählen

<body>
zu:

Code: Alles auswählen

<body onload="alert(navigator.appName + navigator.appVersion)">
Dann teste das ganze noch einmal. Mei mir steht da:
Microsoft Internet Explorer4.0 (compatible; MSIE 7.0; Windows NT 6.2; Win64; x64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)
Und bei mir geht es ebenfalls nicht.

Wahrscheinlich haben die anderen in der Registry das ganze mal generell auf eine aktuelle Version gesetzt. Aber in der Version 4.0 ist white-space: nowrap; inkompatibel ;)

Also entweder &nbsp; setzen oder dem Programm eine aktuelle Steuerelementversion zuschieben: http://purebasic.fr/german/viewtopic.ph ... et+version
PC: Ryzen 9 3950X | 96 GB RAM | RX6800XT | 2,5 TB NVMe | Linux Mint
Notebook: 16" 3:2 | Ryzen 7 5800H | 16 GB RAM | Radeon Vega | 1TB NVMe | Linux Mint
NAS: Fritz.Box 5690 Pro (Nur für Keepass-DB)
Coding: Purebasic, Spiderbasic, GDevelop, Javascript/Node
Benutzeravatar
marcelx
Beiträge: 429
Registriert: 19.02.2010 20:19
Wohnort: Darmstadt

Re: WebGadget table nowrap ellipsis

Beitrag von marcelx »

Danke TroaX,

in der Tat, ich habe MS IE4.0 als Eintrag:
Bild

Gruß
MarcelX
Zuletzt geändert von marcelx am 05.01.2017 21:08, insgesamt 1-mal geändert.
Win-10, PB 5.31 (Windows - x86)
Benutzeravatar
marcelx
Beiträge: 429
Registriert: 19.02.2010 20:19
Wohnort: Darmstadt

Re: WebGadget table nowrap ellipsis

Beitrag von marcelx »

mit den Meta-Eintrag

Code: Alles auswählen

<meta http-equiv='X-UA-Compatible' content='IE=edge'>
funktionniert
Win-10, PB 5.31 (Windows - x86)
Antworten