📄 النص الكامل للصفحة
MIT APP INVENTOR
Projects Connect Build Settings Help
Visit_SA_App
Cities Add Screen Remove Screen Publish to Gallery
Blocks Viewer
Built-in
Control
Logic
Math
Text
Lists
Dictionaries
Colors
initialize global selection to ""
join
length
Variables
Procedures
Cities
discover_label
VerticalArrangement1
cities_label
riyadh_list
jeddah_list
Any component
when riyadh_list .AfterPicking do
when riyadh_list .BeforePicking do
when riyadh_list .GotFocus do
when riyadh_list .LostFocus do
initialize global name to
get
set to
initialize local name to in
when riyadh_list .AfterPicking do set global selection to
وزارة التعليم
Ministry of Education
2025 - 1447
164
--- VISUAL CONTEXT ---
**DIAGRAM**: MIT App Inventor Blocks Editor - Global Variable Initialization
Description: A screenshot of the MIT App Inventor Blocks editor showing the 'Built-in' categories (Control, Logic, Math, Text, Lists, Dictionaries, Colors) on the left. On the right, a block for initializing a global variable named 'selection' to an empty string is shown. This block is 'initialize global selection to' and it is connected to a pink text block containing an empty string literal ('""'). Other pink blocks like 'join' and 'length' are also visible but not connected. A blue circle with the number '2' points from the empty string block to the 'initialize global selection to' block, indicating a connection or a step in a tutorial.
Context: This diagram illustrates how to declare and initialize a global variable named 'selection' with an empty string value in MIT App Inventor, a fundamental step in setting up variables for an application.
**DIAGRAM**: MIT App Inventor Blocks Editor - Riyadh List Event Handlers
Description: A screenshot of the MIT App Inventor Blocks editor. The left panel shows 'Built-in' categories and 'Cities' components, including 'riyadh_list' and 'jeddah_list'. The main workspace displays several event handler blocks for the 'riyadh_list' component: 'when riyadh_list .AfterPicking do', 'when riyadh_list .BeforePicking do', 'when riyadh_list .GotFocus do', and 'when riyadh_list .LostFocus do'. An identical 'when riyadh_list .AfterPicking do' block is shown isolated on the right side of the workspace. A blue circle with the number '3' points from the 'AfterPicking' block on the left to the isolated one on the right, suggesting a focus on this specific event.
Context: This diagram demonstrates various event handlers available for a list picker component ('riyadh_list') in MIT App Inventor, highlighting the 'AfterPicking' event which is crucial for processing user selections from a list.
**DIAGRAM**: MIT App Inventor Blocks Editor - Setting Global Selection
Description: A screenshot of the MIT App Inventor Blocks editor. The left panel shows 'Built-in' categories and 'Variables' blocks. The main workspace displays several variable-related blocks: 'initialize global name to', 'get', 'set to', and 'initialize local name to in'. On the right, a 'when riyadh_list .AfterPicking do' event block is shown, containing a 'set global selection to' block. A blue circle with the number '4' points from the 'set to' block (from the Variables category) to the 'set global selection to' block within the 'AfterPicking' event, indicating how a variable's value is assigned.
Context: This diagram illustrates how to use the 'set global selection to' block within an 'AfterPicking' event handler to update the value of a global variable ('selection') based on user interaction with a list picker, a common pattern for handling user input in App Inventor.
🎴 بطاقات تعليمية للمراجعة
عدد البطاقات: 5 بطاقة لهذه الصفحة
ما هو الغرض من كتلة 'initialize global selection to' في MIT App Inventor؟
الإجابة: تهدف هذه الكتلة إلى إنشاء متغير عام (global variable) باسم 'selection' وتهيئته بقيمة سلسلة نصية فارغة ('') عند بدء تشغيل التطبيق.
الشرح: تعتبر تهيئة المتغيرات العامة خطوة أساسية في برمجة التطبيقات، حيث تحدد مكاناً في الذاكرة لتخزين البيانات التي قد تحتاجها عدة شاشات أو إجراءات في التطبيق.
تلميح: فكر في الخطوة الأولى اللازمة لاستخدام متغير يمكن الوصول إليه من أي جزء في التطبيق.
التصنيف: تعريف | المستوى: سهل
ما هي الأحداث (Event Handlers) المتاحة للتعامل مع مكون 'riyadh_list' في MIT App Inventor كما ورد في الصفحة؟
الإجابة: الأحداث المتاحة هي: 'AfterPicking' (بعد الاختيار)، 'BeforePicking' (قبل الاختيار)، 'GotFocus' (عند الحصول على التركيز)، و 'LostFocus' (عند فقدان التركيز).
الشرح: تتيح معالجات الأحداث للمبرمج تحديد الكود الذي سيُنفذ استجابةً لإجراءات محددة يقوم بها المستخدم أو يمر بها المكون، مما يجعل التطبيق تفاعلياً.
تلميح: ركز على الأسماء التي تصف لحظات تفاعل المستخدم مع قائمة الاختيار.
التصنيف: مفهوم جوهري | المستوى: متوسط
ما الفرق بين كتلة 'initialize global' وكتلة 'set global' في MIT App Inventor؟
الإجابة: كتلة 'initialize global' تُستخدم لإنشاء متغير عام وتعيين قيمته الابتدائية (عادةً عند بدء التشغيل). بينما كتلة 'set global' تُستخدم لتغيير (تحديث) قيمة متغير عام موجود مسبقاً في أي وقت أثناء تشغيل التطبيق، مثلًا داخل معالج حدث.
الشرح: يمثل هذا الفرق مفهومين أساسيين في البرمجة: التهيئة (الإعلان عن المتغير وتعيين قيمته الأولى) والتعيين (تعديل القيمة المخزنة لاحقاً).
تلميح: فكر في توقيت استخدام كل كتلة: واحدة للبداية، والأخرى للتعديل لاحقاً.
التصنيف: فرق بين مفهومين | المستوى: متوسط
ما هي الخطوات الأساسية الموضحة في الصفحة لمعالجة اختيار المستخدم من قائمة 'riyadh_list'؟
الإجابة: الخطوات هي: 1- استخدام معالج الحدث 'when riyadh_list .AfterPicking do'. 2- وضع كتلة 'set global selection to' داخل معالج الحدث المذكور. 3- تعيين قيمة المتغير العام 'selection' بناءً على العنصر الذي اختاره المستخدم من القائمة.
الشرح: يمثل هذا النمط (Event-Driven Programming) أساس البرمجة التفاعلية، حيث يكون تنفيذ الكود رداً على أفعال المستخدم.
تلميح: تتبع التسلسل: حدث ينتظر فعل المستخدم، ثم إجراء لتحديث البيانات.
التصنيف: صيغة/خطوات | المستوى: صعب
لماذا يُعتبر حدث 'AfterPicking' مهماً بشكل خاص لمكونات القوائم (List Picker) في MIT App Inventor؟
الإجابة: لأن حدث 'AfterPicking' يُنفّذ مباشرة بعد أن يقوم المستخدم باختيار عنصر من القائمة، مما يجعله المكان الأنسب لوضع الكود الذي يعالج هذا الاختيار، مثل حفظ القيمة المختارة في متغير أو عرض معلومات إضافية.
الشرح: يضمن استخدام الحدث المناسب استجابة التطبيق في الوقت الصحيح وتجربة مستخدم سلسة ومنطقية.
تلميح: فكر في اللحظة المناسبة لتنفيذ رد فعل التطبيق على اختيار المستخدم.
التصنيف: تفكير ناقد | المستوى: تفكير ناقد