Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Общие вопросы > combobox keydown help


Автор: muratboy31 9.2.2010, 16:26
i want combobox to complite www.      .com   when press CTRL and ENTER keys like internet explorer but i couldnt manage it...

Код

procedure TForm1.IEAddress1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if key = vk_return then  begin
btnGoclick(self) end else
if (VK_CONTROL and VK_RETURN) then  begin
IEAddress1.Text:='www.' + IEAddress1.Text + '.com';
Webbrowser1.Go(IEAddress1.Text);
end;
end;

Автор: Mikel 9.2.2010, 16:30
Код

if key = vk_return
   then begin
          if ssCtrl in Shift
             then begin
                    IEAddress1.Text:='www.' + IEAddress1.Text + '.com';
                    Webbrowser1.Go(IEAddress1.Text);
                  end
             else btnGoclick(self)
        end


Автор: muratboy31 9.2.2010, 16:45
thanks for your help
but i have another question;
what if i want to use  also www.   .net   CTRL and N    button combination ?


Код

procedure TForm1.IEAddress1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (ssctrl in shift) and (key=vk_return) then
begin
IEAddress1.Text:='www.' + IEAddress1.Text + '.com';
                    GetActiveEWB.Go(IEAddress1.Text);
end else
if  (ssctrl in shift) and (key=4E) then
begin
IEAddress1.Text:='www.' + IEAddress1.Text + '.net';
                    GetActiveEWB.Go(IEAddress1.Text);
end;

Автор: Mikel 9.2.2010, 17:20
I prefer this variant smile
Код

procedure TForm1.IEAddress1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if ssctrl in shift
 then case key of
  vk_return:
begin
IEAddress1.Text:='www.' + IEAddress1.Text + '.com';
                    GetActiveEWB.Go(IEAddress1.Text);
end;
4E:
begin
IEAddress1.Text:='www.' + IEAddress1.Text + '.net';
                    GetActiveEWB.Go(IEAddress1.Text);
end;
end;
end;


Автор: muratboy31 9.2.2010, 17:45
i got error saying ;
Цитата

Syntax error in real number

Автор: Mikel 9.2.2010, 18:01
"4e" -> "$4e"

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)