![]() |
kein Focus im 4 index
Hallo Leute,
ich habe ein kleines Problem. Ich schreibe für ein Blinden ein Programm. Dort mussen die ersten 3 Elemente der Combobox -->ComboBox1.Style:=csOwnerDrawFixed sein damit Virgo(BlindenSoftware) die Combobox als Aufklappliste sieht. Das 4 Element soll aber wiederrum zu ein Eingabefeld werden --> ComboBox1.Style:=csDropDown; Mein Problem ist nun das wenn jemand ins 4 Element geht der Focus verschwindet und der Blinde nichts ändern kann im 4 Element der Combobox.
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) ComboBox1: TComboBox; procedure FormCreate(Sender: TObject); procedure ComboBox1KeyPress(Sender: TObject; var Key: Char); procedure ComboBox1Select(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin ComboBox1.Text:='Standartwert'; ComboBox1.items.add('nein'); ComboBox1.items.add('Durch alleinstehendes Semikolon'); ComboBox1.items.add('Durch Originalseitenangabe'); ComboBox1.items.add('...'); ComboBox1.ItemIndex:=0; end; procedure TForm1.ComboBox1KeyPress(Sender: TObject; var Key: Char); begin if (Combobox1.ItemIndex=0)OR(Combobox1.ItemIndex=1)OR(Combobox1.ItemIndex=2) then begin if not (Key in[#26]) then begin Key := #0; Windows.Beep(500, 100); Windows.Beep(400, 100); Windows.Beep(300, 100); //Windows.Beep(200, 100); //Windows.Beep(100, 100); end end end; procedure TForm1.ComboBox1Select(Sender: TObject); begin if (Combobox1.ItemIndex=0)OR(Combobox1.ItemIndex=1)OR(Combobox1.ItemIndex=2) then ComboBox1.Style:=csOwnerDrawFixed else begin ComboBox1.Style:=csDropDown; ComboBox1.Focused; ComboBox1.ItemIndex:=3; ComboBox1.SetFocus; //ComboBox1.Refresh //ComboBox1.ItemIndex:=3; end end; end. Ich hoffe es kann mir einer bei mein Problem helfen mfg Robert |
Re: kein Focus im 4 index
Hallo :hi:,
ich hab dein Problem nicht ganz verstanden, aber ich hoffe der Code hilft dir weiter. :)
Delphi-Quellcode:
MfG
procedure TForm1.ComboBox1Select(Sender: TObject);
var lItemIndex: Integer; begin lItemIndex := ComboBox1.ItemIndex; if (lItemIndex < 3) then ComboBox1.Style := csOwnerDrawFixed else ComboBox1.Style := csDropDown; ComboBox1.Focused; ComboBox1.ItemIndex := lItemIndex; ComboBox1.SetFocus; end; freak |
Re: kein Focus im 4 index
Liste der Anhänge anzeigen (Anzahl: 1)
mein Problem ist damit nicht ganz gelöst.
ich hab das projekt angehangen. scroll mal runter zum 4 element |
Re: kein Focus im 4 index
kann mir den keiner zu den Problem Tipps geben oder eine Lösungsidee?
mfg Robert Slo. |
Re: kein Focus im 4 index
Hi :hi:,
ich hab eine Combobox mit OnLooseFocus benutzt und da den Focus gesetzt, aber daran liegt es nicht. Den Focus hat die Combobox. Der Focus scheint auf dem Button in der Combobox zu stehen und nicht auf dem Eingabefeld. :( MfG freak |
Re: kein Focus im 4 index
und was kann man da machen das es auf das eingabefeld gesetzt wird ?
Ich habe es auch schon mit x.ItemIndex:=3; versucht. aber das scheint delphi egal zu sein :( |
Re: kein Focus im 4 index
Huhu :hi:,
nächste Idee. :)
Delphi-Quellcode:
Ist keine schöne Lösung, aber funktioniert. :angel:
procedure TForm1.ComboBox1Select(Sender: TObject);
begin with ComboBox1 do begin if (ItemIndex < 3) then Style := csOwnerDrawFixed else begin Style := csDropDown; Button1.SetFocus; SetFocus; end; end; end; MfG freak |
Re: kein Focus im 4 index
es stimmt schön ist es nicht aber immerhin geht es :)
Blöd ist nur das ein Button da sein muss. Aber das wichtigste ist das mir geholfen wurde. Vielen dank freak4fun mfg robert |
Re: kein Focus im 4 index
Du kannst auch eine andere Combobox benutzen. :gruebel:
[edit] Alles was halt dieses SetFocus unterstützt. Das Formulat geht leider nicht dafür. Musst halt gucken ob du noch was anderes auf deinem Formular leigen hast, das geht. Mann kann bei dem Button auch Breite und Höhe auf 0 stellen. Aber er muss sichtbar sein. [/edit] MfG freak |
Re: kein Focus im 4 index
Zitat:
air |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:46 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz