Autor Beitrag
ecomit
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Fr 29.08.03 15:02 
Hi,

ich habe die TWebbrowserkompo in meinem Form platziert und habe ein Formular mit einer Textarea. Leider kann ich bei der Eingabe keinen mehrzeiligen Text schreiben, da die ENTER Taste schlicht ignoriert zu werden scheint.

Kennt jemand eine Lösung/Workaround?

Thanx

Ralph
DaRkFiRe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 526

WinXP Home & Professional
C, C++, Delphi
BeitragVerfasst: Fr 29.08.03 16:08 
Strg+Enter?

Ansonsten empfehle ich mal SelfHTML -> HTML -> Formulare -> Mehrzeilige Eingabefelder

_________________
Lang ist der Weg durch Lehren - kurz und wirksam durch Beispiele! Seneca
kasi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37

Win XP
D5 Ent
BeitragVerfasst: Fr 29.08.03 16:47 
ausblenden volle Höhe Delphi-Quelltext
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:
{ 
  Problem: 

  Web forms that have multi-line text boxes and/or Submit buttons do not 
  respond to the Enter key when displayed on a TWebbrowser. 
  Also when browsing local folders, some keys don't respond. 

  How to solve it: 
}
 

unit Unit1; 

interface 

uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, OleCtrls, SHDocVw_TLB, ActiveX, StdCtrls; 

type 
  TForm1 = class(TForm) 
    WebBrowser1: TWebBrowser; 
    Button1: TButton; 
    Button2: TButton; 
    procedure FormDestroy(Sender: TObject); 
    procedure FormCreate(Sender: TObject); 
    procedure Button1Click(Sender: TObject); 
    procedure Button2Click(Sender: TObject); 
  private 
    { Private declarations } 
    FOleInPlaceActiveObject: IOleInPlaceActiveObject; 
    procedure MsgHandler(var Msg: TMsg; var Handled: Boolean); 
  public 
    { Public declarations } 
  end; 

var 
  Form1: TForm1; 


implementation 

{$R *.dfm} 

procedure TForm1.FormDestroy(Sender: TObject); 
begin 
  FOleInPlaceActiveObject := nil; 
end; 

procedure TForm1.FormCreate(Sender: TObject); 
begin 
  Application.OnMessage := MsgHandler; 
end; 

procedure TForm1.MsgHandler(var Msg: TMsg; var Handled: Boolean); 
const 
  DialogKeys: set of Byte = [VK_LEFT, VK_RIGHT, VK_BACK, $30..$39, $41..$5A]; 
var 
  iOIPAO: IOleInPlaceActiveObject; 
  Dispatch: IDispatch; 
begin 
  { exit if we don't get back a webbrowser object } 
  if (WebBrowser1 = nil) then 
  begin 
    Handled := System.False; 
    Exit; 
  end; 

  Handled := (IsDialogMessage(WebBrowser1.Handle, Msg) = System.True); 

  if (Handled) and (not WebBrowser1.Busy) then 
  begin 
    if FOleInPlaceActiveObject = nil then 
    begin 
      Dispatch := WebBrowser1.Application; 
      if Dispatch <> nil then 
      begin 
        Dispatch.QueryInterface(IOleInPlaceActiveObject, iOIPAO); 
        if iOIPAO <> nil then 
          FOleInPlaceActiveObject := iOIPAO; 
      end; 
    end; 

    if FOleInPlaceActiveObject <> nil then 
      if ((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP)) and 
        (Msg.wParam in DialogKeys) then 
        // nothing - do not pass on the DialogKeys 
      else 
        FOleInPlaceActiveObject.TranslateAccelerator(Msg); 
  end; 
end;


KASI
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Di 27.01.04 15:15 
Leider Funktionieren nach diesem Code keine ShortCuts mehr...

STRG+F, STRG+P, C und V (etc...)

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 27.01.04 16:25 

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Di 27.01.04 17:17 
Ähm, das ist der Code von oben ;-)

Den Teil mit der Initialization und Finalization hab ich bereits gemacht, und funzt ohne den oben genannten code wunderbar...

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 27.01.04 19:03 
Chatfix hat folgendes geschrieben:
Ähm, das ist der Code von oben ;-)

:autsch: tja wer lesen kann ist doch klar im vorteil !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Di 27.01.04 19:24 
Anstat dumme reden zu schwingen, könntest du mir bitte den unterschied posten?

sorry

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mi 28.01.04 14:52 
ich meinte damit mich. ich hätte besser lesen sollen. ic hab damit niemanden beleidigen wollen !!! sorry.

ne andere möglichkeit kenn ich nicht. entweder du gibts den kompfort der enter taste auf, oder du gibst die shortcuts auf...

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Mi 28.01.04 15:03 
achso, ich dachte du meinst mich damit, und ich hätte den unterschied nicht erkannt :oops:

naja dann muss ich wohl vorerst auf die enter taste verzichten...

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
F.Art
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 434



BeitragVerfasst: Sa 28.08.04 09:31 
Wenn ich den Code von SwissDelphiCenter nehme funktioniert die Entertaste nun, aber wie jemand anderes erwänt hat, geht das kopy/paste per Tastatur nicht mehr. Wie behebe ich das Problem wieder das Enter und Kopy / Paste geht?
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Fr 11.03.05 09:43 
Titel: hmm,
das Topic ist zwar alt aber genau was ich gesucht hab, gibt es mittlerweile eine Fix oder eine Idee bzgl. C&P ?

_________________
mfg. Joel
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: So 13.03.05 12:20 
Hallo,

Habe den obigen Code mal ueberarbeitet, damit auch
STRG+F, STRG+P, C und V (etc...) funktionieren:

www.swissdelphicente...showcode.php?id=1055
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Di 15.03.05 10:16 
Titel: hmm,
irgendwie gehts noch nicht richtig.

Ich hab folgende Fragen dazu

1. ist es absicht dass es
ausblenden Delphi-Quelltext
1:
2:
  ExtKeys = [VK_DELETE, VK_BACK, VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN,
    $30..$39, $41..42, $44..$55, $57, $59..$5A]; { extended keys }


mit normaler 42? sollte das nicht $42 heissen?

Und dann gibt es ein Problem mit der Backspacetaste, die löscht fast immer 2 Zeichen und nicht nur eine.

_________________
mfg. Joel
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Di 15.03.05 12:26 
Habe den Code nochmals bearbeitet. Hoffentlich geht nun alles.
Sonst einfach melden...
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Sa 19.03.05 14:11 
Titel: hmm,
mit den Mozillabrowser funktioniert es jetzt supi!

_________________
mfg. Joel
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mo 04.04.05 10:27 
Titel: hmm,
ich hab jetzt TabbedBrowsing eingebaut und bin auf ein Phänomen gestossen welches ich nicht verstehe, bin nicht gar so mit der Windows-API vertraut muss ich zugeben.

Also, ich nutze eine Pagecontrol of der ich jeweils neue Tabsheets kreiere und darauf ne MozillaKomponente plaziere. Ist nur ein Tabsheet vorhanden dann fünktioniert meine MsgHandler Procedure tadelos.

ausblenden volle Höhe Delphi-Quelltext
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:
procedure TForm1.MsgHandler(var Msg: TMsg; var Handled: Boolean);
const
  StdKeys = [VK_BACK, VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT];
  FVKs = [VK_F1, VK_F2, VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10, VK_F11, VK_F12];
  //Wolframkeys = [33,34] ;
 // ExtKeys = [VK_DELETE, VK_BACK, VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN,
 //   $30..$39, $41..$42, $44..$55, $57, $59..$5A]; { extended keys }
  //fExtended = $01000000; { extended key flag }
var
  IOIPAO: IOleInPlaceActiveObject;
  Dispatch: IDispatch;
begin
  //inherited;
  ti_2.Text := IntToStr(ti2);
  inc(ti2);
  if (Msg.message = WM_KEYDOWN) AND (Msg.wParam in FVKs) then
  begin
    case Msg.wParam of
      VK_F1 : check_vorlagen('<F1>');
      VK_F2 : check_vorlagen('<F2>');
      VK_F3 : check_vorlagen('<F3>');
      VK_F4 : check_vorlagen('<F4>');
      VK_F5 : check_vorlagen('<F5>');
      VK_F6 : check_vorlagen('<F6>');
      VK_F7 : check_vorlagen('<F7>');
      VK_F8 : check_vorlagen('<F8>');
      VK_F9 : check_vorlagen('<F9>');
      VK_F10 : check_vorlagen('<F10>');
      VK_F11 : check_vorlagen('<F11>');
      VK_F12 : check_vorlagen('<F12>');
    end;
  end;
  if p_browser.PageCount > 0 then
  begin
    ti_2.Text := IntToStr(ti2);
    inc(ti2);
    if (Msg.message = WM_KEYDOWN)  AND ((Msg.wParam = VK_LBUTTON) OR (Msg.wParam = VK_RBUTTON)) then
       (p_browser.ActivePage.Controls[0] as TMozillaBrowser).SetFocus;
    if (Msg.message = WM_KEYDOWN)  AND (Msg.wParam = 33) AND (getkeyState(VK_CONTROL) < 0) then
    begin
      P_Browser.SelectNextPage(true,false);
    end;
    if (Msg.message = WM_KEYDOWN)  AND (Msg.wParam = 34) AND (getkeyState(VK_CONTROL) < 0) then
    begin
      P_Browser.SelectNextPage(false,false);
    end;
    if (Msg.message = WM_KEYDOWN)  AND ((Msg.wParam = Ord('T')) OR (Msg.wParam = Ord('t'))) AND (getkeyState(VK_CONTROL) < 0) then
    begin
      inNewTab(false);
    end;
    if (Msg.message = WM_KEYDOWN)  AND ((Msg.wParam = Ord('F')) OR (Msg.wParam = Ord('f'))) AND (getkeyState(VK_CONTROL) < 0) then
    begin
      SearchAndHighlightText('Perry');
    end;
    if (p_browser.ActivePage.Controls[0] as TMozillaBrowser) = nil then
    begin
      Handled := False;
      Exit;
    end;
    Handled := (IsDialogMessage((p_browser.ActivePage.Controls[0] as TMozillaBrowser).Handle, Msg) = True);
    if (Handled) and (not (p_browser.ActivePage.Controls[0] as TMozillaBrowser).Busy) then
    begin
      ti_i.Text := IntToStr(ti);
      inc(ti);
      if FOleInPlaceActiveObject = nil then
      begin
        Dispatch := (p_browser.ActivePage.Controls[0] as TMozillaBrowser).Application;
        if Dispatch <> nil then
        begin
          Dispatch.QueryInterface(IOleInPlaceActiveObject, IOIPAO);
          if IOIPAO <> nil then FOleInPlaceActiveObject := IOIPAO;
        end;
      end;
      if FOleInPlaceActiveObject <> nil then
        if ((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP)) and
          (Msg.wParam in StdKeys) then
          //nothing  -  do not pass on Backspace, Left, Right, Up, Down arrows
        else
          FOleInPlaceActiveObject.TranslateAccelerator(Msg);
  {    if FOleInPlaceActiveObject <> nil then
        if ((Msg.message = WM_KEYDOWN) or (Msg.message = WM_KEYUP)) and
          ((Msg.wParam in ExtKeys) and ((Msg.lParam and fExtended) = fExtended)) then
          //nothing  -  do not pass on Backspace,  Left or Right arrows
        else
          FOleInPlaceActiveObject.TranslateAccelerator(Msg);   }

    end;
  end
  else
    handled := false;
end;

Wenn ich dann aber eine neues zusätzliches Tabsheet aufmache dann reagiert die Variable handled
ausblenden Delphi-Quelltext
1:
Handled := (IsDialogMessage((p_browser.ActivePage.Controls[0] as TMozillaBrowser).Handle, Msg) = True);					

nichtmehr auf Tastendrücke, sondern wird nur noch bei Mausbewegungen true.

Dieser Effekt bleibt auf allen Tabs, ausser dem neusten (dieses Funktioniert!!), erhalten. Zuerst wenn ich alle schliese und dann ein neues öffne dann reagiert dies wieder.

Ich hab leider keine ahnung wieso :(

_________________
mfg. Joel
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mo 04.04.05 14:42 
Titel: hmm,
hab jetzt mal ein wenig genauere Test durchgeführt, es liegt nicht am Messagehandler, es liegt scheinbar genau an dieser Funktion, die ich verwende um neue Tabs zu erzeugen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.NewWindow(Sender: TObject;var ppDisp: IDispatch; var Cancel: WordBool);
begin
  innewtab(true);
  //Anfrage umleiten (neue seite im neuen webbrowserdentseranzeigen)
  ppDisp := (p_browser.ActivePage.Controls[0] as TMozillaBrowser).DefaultInterface;
end;

Diese Funktion liegt auf dem onNewWindow2 Event der Browserkomponente.


Wie ich festgestellt habe funktionieren alle die Tabs von denen aus KEIN neues Tab erzeugt wurde. Die Tabs von denen aus ein neues Tab erzeugt wurde verlieren die Funktionalität des Messagehandlers. Komisch oder einfach erklärbar?

_________________
mfg. Joel
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 04.04.05 15:20 
Nimmmal diesen einfachen Message Handler und überprüfe, ob die gleichen Phänomene auftreten



ausblenden volle Höhe Delphi-Quelltext
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:
procedure TForm1.MsgHandler(var Msg: TMsg; var Handled: Boolean); 
const
  StdKeys = [VK_TAB, VK_RETURN]; { standard keys }
  ExtKeys = [VK_DELETE, VK_BACK, VK_LEFT, VK_RIGHT]; { extended keys }
  fExtended = $01000000; { extended key flag }
var
  CurrentWB: TMozillaBrowser;
begin
  CurrentWB := p_browser.ActivePage.Controls[0] as TMozillaBrowser;   
  if CurrentWB = nil then  
  begin  
    Handled := False;  
    Exit;  
  end;  

  if IsChild(CurrentWB.Handle, Msg.Hwnd) then
  begin
    if (Msg.Message = WM_CLOSE) then
      msg.message := 0
    else
      if ((Msg.Message >= WM_KEYFIRST) and (Msg.Message <= WM_KEYLAST)) and
        ((Msg.wParam in StdKeys) or (GetKeyState(VK_CONTROL) < 0) or
        (Msg.wParam in ExtKeys) and ((Msg.lParam and fExtended) = fExtended)) then
      begin
        Handled := (CurrentWB.Application as IOleInPlaceActiveObject).TranslateAccelerator(Msg) = S_OK;
        if not Handled then
        begin
          Handled := True;
          TranslateMessage(Msg);
          DispatchMessage(Msg);
        end;
      end;
  end;
end;
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Di 05.04.05 08:06 
Titel: hmm,
gleicher Effekt, ich denke es liegt nicht am Messagehandler, denn auch wenn man den Standardhandler nutzt (die Pfeiltastenproblematik also ausklammert) dann funktioniert es auch nicht. Es funktioniert immer nur im aktuellsten Unterfenster. Was interessant ist, man kann von einem Fenster mehrere unterfenster generieren , dann funtionieren alle diese Unterfenster, solange sie nicht selbst Unterfenster erhalten.

Komisch.

_________________
mfg. Joel