كيف أفصل خيارات RadioGroup
#1
[COLOR="black"][COLOR="black"][COLOR="black"]مرحبا جميعا

أخوكم مبتدأ في البرمجة لا تضحكوا على استفساري Big Grin
لدي استفسار : زر واحد للضغط وثلاثة خيارات RadioGroup
كل خيار من RadioGroup يتحقق من الارقام في edit و يظهر النتيجة في labl
[صورة: sQ6oOF.jpg]
لم تفلح معي
case ولا if مع اني برمجت كل خيار من RadioGroup في جزء بين بيقين واند
الهدف هو عمل كل خيار من RadioGroup على حدى
كيف أضع شرط التحقق من الرقم في edit واظهار النتيجة فيlabl دون خلط البرنامج
لأن البرنامج عاد يخلط في النتيجة وخلطني معاه:confused:[/COLOR][/COLOR][/COLOR]
الرد
#2
كود :
if RadionButton1.checked Then begin // Code end else if RadioButton2.checked Then begin // code end else if RadioButton3.checked Then begin //code end
الرد
#3
أرفق مثال هنا
سبحان الله وبحمده سبحان الله العظيم
الرد
#4
ghost-dz كتب :أرفق مثال هنا

مثال
كود :
procedure TForm1.Button1Click(Sender: TObject); begin if RadioGroup1.ItemIndex =0 then if StrToInt(Edit1.Text) in [0..100] then Edit1.Color := clGreen else Edit1.Color := clRed; if StrToInt(Edit1.Text) in [0..100] then begin Label2.Caption:='correcte'; Label2.Font.Color := clGreen; end else begin Label2.Caption:='incorrecte'; Label2.Font.Color := clRed; end; begin if RadioGroup1.ItemIndex =1 then if StrToInt(Edit1.Text) in [101..200] then Edit1.Color := clGreen else Edit1.Color := clRed; if StrToInt(Edit1.Text) in [101..200] then begin Label2.Caption:='correcte'; Label2.Font.Color := clGreen; end else begin Label2.Caption:='incorrecte'; Label2.Font.Color := clRed; end; begin if RadioGroup1.ItemIndex =2 then if StrToInt(Edit1.Text) in [201..255] then Edit1.Color := clGreen else Edit1.Color := clRed; if StrToInt(Edit1.Text) in [201..255] then begin Label2.Caption:='correcte'; Label2.Font.Color := clGreen; end else begin Label2.Caption:='incorrecte'; Label2.Font.Color := clRed; end; end; end; end; end.
الرد
#5
الحمد لله واخيرا وجدت الحل

شكرا لكم جميعا


[COLOR="black"] [COLOR="black"][COLOR="black"]لو تكرمتم ماذا أفعل لكل لكي لا ينفذ البرنامج الا بعد ادخال جميع قيم edit الاربعة

يعني ادا كانت قيمة edit واحدة فارغة لا ينفذ

وشكرا [/COLOR][/COLOR] [/COLOR]Big Grin

أو رسالة showmessage

تقول' أدخل كل قيم edit '
الرد
#6
كود :
if edit1.text='' then showmessage('يجب ملأ الحقل')
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم