Autor Beitrag
GigaNeko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Mo 13.06.05 15:56 
ich habe vor eine chemie-datenbank zu schreiben. dazu muss ich wissen wie ich in einem editfeld index-zahlen und exponenten anzeigen und eingeben kann.
könnt ihr mir weiterhelfen?


Moderiert von user profile iconraziel: Topic aus Sonstiges verschoben am Mo 13.06.2005 um 16:59
Becks16
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Mo 13.06.05 16:04 
wie meinst du das ganau ??

mfg

_________________
Ich bin Dumm und weiss nichts :-)
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mo 13.06.05 16:07 
Na, die Indizierungen von H2O, wo die 2 etwas tiefer und kleiner ist.

Also, so ein Edit-Feld habe ich noch nicht gesehen. Es gibt/gab aber immerhin ein TChemLabel oder so ähnlich bei www.torry.net. Da konnte man sich zumindest so etwas anzeigen lassen. Ich meine sogar, mit Struktur und so.

Du müsstest Dir so etwas selbst schreiben.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 13.06.05 16:08 
Das geht gar nicht. Du könntest das Umgehen durch H_2O für Wasser und m^2 für Quadratmeter. Als Eingabe wäre das immer noch gut (wird ja auch bei LaTeX so gemacht), aber für die Anzeige unschön. Du könntest das dann selber zeichnen, oder nach anderen Komponenten suchen. Evtl. kann TRichedit das, ansonsten bei torry suchen.

EDIT: Hach, ich werde alt. Ich bin so langsam. Alt. Müde.

_________________
We are, we were and will not be.
GigaNeko Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Mo 13.06.05 16:14 
hmmm würde es nicht auch gehen wenn ich irgendwie einstellen könnte, dass immer wenn ich eine zahle eingebe, diese dann einfach in einer kleineren schriftgröße angezeigt wird? (exponenten sindnicht so wichtig in der chemie glaube ich)
wie müsste ich das dann programmieren?
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Mi 15.06.05 08:31 
hi du!

du müsstest dann die TRichEdit komponenten für die Eingabe benutzen. mit dieser kannst du nämlich einzelne zeichen anders darstellen. such mal nach SelAttributes hier im forum.

lg martin
GigaNeko Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Mi 15.06.05 16:08 
aha aber so ganz verstehe ich das nicht mit dem SelAttributes.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Mi 15.06.05 22:29 
Nee, Du kannst Dir eine relativ einfache Paint-Methode für ein TLabel schreiben, so nach dem Motto (Pseudocode):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Procedure DrawText (x,y : Integer; aFormula : String);
Begin
  For i:=1 to Length (aFormula) do begin
    C := aFormula[i]
    If IsDigit (C) Then begin
      DrawCharacter (X,Y + IndexGap, Smallfont, C)
      X := X + CharacterWidth (C, SmallFont)
      End
    Else begin
      DrawCharacter (X,Y , DefaultFont, C)
      X := X + CharacterWidth (C, DefaultFont)
      End
    End
End;

Wobei DrawCharacter an der Stelle X,Y im angegebenen Font ein Zeichen C malt und CharacterWidth die Breite des Zeichens C im angegebenen Font liefert.

Die Eingabe ginge dann tatsächlich so : H2O oder C2H5OH...