QB64.org Forum

QB64 Team Software => InForm-based programs => Topic started by: TempodiBasic on November 04, 2020, 07:34:35 pm

Title: IQ test developed using Inform 1.2
Post by: TempodiBasic on November 04, 2020, 07:34:35 pm
Hi
here is a simple IQtest that I have built to use and test Inform 1.2
For now I post these because I have NOT more complex or/and bigger program to show.
this is the code
Code: QB64: [Select]
  1. ': This program uses
  2. ': InForm - GUI library for QB64 - v1.2
  3. ': Fellippe Heitor, 2016-2020 - fellippe@qb64.org - [member=2]FellippeHeitor[/member]
  4. ': https://github.com/FellippeHeitor/InForm
  5. '-----------------------------------------------------------
  6.  
  7. ': Controls' IDs: ------------------------------------------------------------------
  8. DIM SHARED IQTest AS LONG
  9. DIM SHARED ClickOnTheSTOPButtonBeforeTimeILB AS LONG
  10. DIM SHARED STOPClickMeBT AS LONG
  11. DIM SHARED ProgressBar1 AS LONG
  12. DIM SHARED ProgressBar2 AS LONG
  13. DIM SHARED PartialTimeLB AS LONG
  14. DIM SHARED TotalTimeLB AS LONG
  15. ': External modules: ---------------------------------------------------------------
  16. '$INCLUDE:'InForm\InForm.ui'
  17. '$INCLUDE:'InForm\xp.uitheme'
  18. '$INCLUDE:'IQTest.frm'
  19.  
  20. ': Event procedures: ---------------------------------------------------------------
  21. SUB tt
  22.     BEEP
  23.     IF Control(ProgressBar2).Value >= 10 THEN
  24.         BEEP
  25.         Control(ProgressBar1).Value = Control(ProgressBar1).Value + 10
  26.         Control(ProgressBar2).Value = 0
  27.     ELSE
  28.         Control(ProgressBar2).Value = Control(ProgressBar2).Value + 1
  29.     END IF
  30.     IF Control(ProgressBar1).Value >= 100 THEN
  31.         _TITLE "BOOM!"
  32.         Caption(STOPClickMeBT) = "TOO LATE!"
  33.         TIMER OFF
  34.         tStatus = False
  35.     END IF
  36.  
  37. SUB MoveButton
  38.     Control(STOPClickMeBT).Left = __UI_MouseLeft + (RND * 100) + 50
  39.     IF Control(STOPClickMeBT).Left > Control(IQTest).Width - Control(STOPClickMeBT).Width THEN Control(STOPClickMeBT).Left = 10
  40.     Control(STOPClickMeBT).Top = __UI_MouseTop + (RND * 100) + 50
  41.     IF Control(STOPClickMeBT).Top >= Control(IQTest).Height - Control(STOPClickMeBT).Height - 60 THEN Control(STOPClickMeBT).Top = 10
  42.  
  43. SUB __UI_BeforeInit
  44.  
  45.  
  46. SUB __UI_OnLoad
  47.     ON TIMER(1) tt
  48.     TIMER ON
  49.     tStatus = True
  50.  
  51. SUB __UI_BeforeUpdateDisplay
  52.     'This event occurs at approximately 30 frames per second.
  53.     'You can change the update frequency by calling SetFrameRate DesiredRate%
  54.     IF tStatus THEN
  55.         IF _MOUSEINPUT THEN
  56.             IF (__UI_MouseLeft < (Control(STOPClickMeBT).Left - 50)) OR (__UI_MouseLeft > (Control(STOPClickMeBT).Left + Control(STOPClickMeBT).Width + 50)) THEN
  57.                 IF (__UI_MouseTop > (Control(STOPClickMeBT).Top - 50)) OR (__UI_MouseTop < (Control(STOPClickMeBT).Top + Control(stopmeclickbt).Height + 50)) THEN
  58.                     __UI_MouseEnter STOPClickMeBT 'MoveButton
  59.                 END IF
  60.             END IF
  61.         END IF
  62.     END IF
  63.  
  64. SUB __UI_BeforeUnload
  65.     'If you set __UI_UnloadSignal = False here you can
  66.     'cancel the user's request to close.
  67.  
  68.  
  69. SUB __UI_Click (id AS LONG)
  70.     SELECT CASE id
  71.         CASE IQTest
  72.  
  73.         CASE ClickOnTheSTOPButtonBeforeTimeILB
  74.  
  75.         CASE STOPClickMeBT
  76.             IF Caption(STOPClickMeBT) = "TOO LATE!" THEN EXIT SUB
  77.             ' the user wins
  78.             _TITLE "YOU WIN!"
  79.             TIMER OFF
  80.             Caption(STOPClickMeBT) = "You GOT IT"
  81.             tStatus = False
  82.         CASE ProgressBar1
  83.  
  84.         CASE ProgressBar2
  85.  
  86.         CASE PartialTimeLB
  87.  
  88.         CASE TotalTimeLB
  89.  
  90.     END SELECT
  91.  
  92. SUB __UI_MouseEnter (id AS LONG)
  93.     SELECT CASE id
  94.         CASE IQTest
  95.  
  96.         CASE ClickOnTheSTOPButtonBeforeTimeILB
  97.  
  98.         CASE STOPClickMeBT
  99.             IF tStatus THEN MoveButton
  100.         CASE ProgressBar1
  101.  
  102.         CASE ProgressBar2
  103.  
  104.         CASE PartialTimeLB
  105.  
  106.         CASE TotalTimeLB
  107.  
  108.     END SELECT
  109.  
  110. SUB __UI_MouseLeave (id AS LONG)
  111.     SELECT CASE id
  112.         CASE IQTest
  113.  
  114.         CASE ClickOnTheSTOPButtonBeforeTimeILB
  115.  
  116.         CASE STOPClickMeBT
  117.  
  118.         CASE ProgressBar1
  119.  
  120.         CASE ProgressBar2
  121.  
  122.         CASE PartialTimeLB
  123.  
  124.         CASE TotalTimeLB
  125.  
  126.     END SELECT
  127.  
  128. SUB __UI_FocusIn (id AS LONG)
  129.     SELECT CASE id
  130.         CASE STOPClickMeBT
  131.  
  132.     END SELECT
  133.  
  134. SUB __UI_FocusOut (id AS LONG)
  135.     'This event occurs right before a control loses focus.
  136.     'To prevent a control from losing focus, set __UI_KeepFocus = True below.
  137.     SELECT CASE id
  138.         CASE STOPClickMeBT
  139.  
  140.     END SELECT
  141.  
  142. SUB __UI_MouseDown (id AS LONG)
  143.     SELECT CASE id
  144.         CASE IQTest
  145.  
  146.         CASE ClickOnTheSTOPButtonBeforeTimeILB
  147.  
  148.         CASE STOPClickMeBT
  149.  
  150.         CASE ProgressBar1
  151.  
  152.         CASE ProgressBar2
  153.  
  154.         CASE PartialTimeLB
  155.  
  156.         CASE TotalTimeLB
  157.  
  158.     END SELECT
  159.  
  160. SUB __UI_MouseUp (id AS LONG)
  161.     SELECT CASE id
  162.         CASE IQTest
  163.  
  164.         CASE ClickOnTheSTOPButtonBeforeTimeILB
  165.  
  166.         CASE STOPClickMeBT
  167.  
  168.         CASE ProgressBar1
  169.  
  170.         CASE ProgressBar2
  171.  
  172.         CASE PartialTimeLB
  173.  
  174.         CASE TotalTimeLB
  175.  
  176.     END SELECT
  177.  
  178. SUB __UI_KeyPress (id AS LONG)
  179.     'When this event is fired, __UI_KeyHit will contain the code of the key hit.
  180.     'You can change it and even cancel it by making it = 0
  181.     SELECT CASE id
  182.         CASE STOPClickMeBT
  183.  
  184.     END SELECT
  185.  
  186. SUB __UI_TextChanged (id AS LONG)
  187.     SELECT CASE id
  188.     END SELECT
  189.  
  190. SUB __UI_ValueChanged (id AS LONG)
  191.     SELECT CASE id
  192.     END SELECT
  193.  
  194. SUB __UI_FormResized
  195.  
  196.  
  197.  
I'll attach the files .BAS  .FRM and you must remember that to compile it you must install InForm 1.2 or at least include falcon.h in the same folder of QB64.
Thanks to try
Title: Re: IQ test developed using Inform 1.2
Post by: SMcNeill on November 04, 2020, 07:52:42 pm
I just scored a -126.

Now I just need to decide if that’s an overflow error, or if I’m really as dumb as my family thinks I am...
Title: Re: IQ test developed using Inform 1.2
Post by: FellippeHeitor on November 04, 2020, 08:24:26 pm
LOL, thanks for sharing, Tempo!
Title: Re: IQ test developed using Inform 1.2
Post by: TempodiBasic on November 05, 2020, 05:32:04 pm
@FellippeHeitor Glad to see you take a look at. I hope to find time to test for news Inform 1.2.

@Steve but QB64 stops at _INTEGER64...it's clear that container is too small!
Title: Re: IQ test developed using Inform 1.2
Post by: segura on December 14, 2020, 06:12:50 am
I just scored a -126.

Now I just need to decide if that’s an overflow error, or if I’m really as dumb as my family thinks I am...
Seems like I'm even dumber because I couldn't even reach the test level and failed in starting it... Could anyone explain to me how to run the code? I'm a beginner at it. I know Python and C, decided to learn QB64 to survive the quarantine in my flat in Greece (https://tranio.com/greece/apartments/) but frankly it's not going very well...
Title: Re: IQ test developed using Inform 1.2
Post by: TempodiBasic on December 15, 2020, 05:52:40 pm
Hi segura
if you're ready to test your IQ with this app you need of Qb64  (best the latest) and in the same folder Inform. 
Today it's simpler than the past to install Inform with its installer.
You can get here QB64 and Inform https://www.qb64.org/portal/ (https://www.qb64.org/portal/)  or from here Inform  https://www.qb64.org/inform/ (https://www.qb64.org/inform/)  AND Qb64 https://github.com/QB64Team/qb64/releases/tag/v1.4 (https://github.com/QB64Team/qb64/releases/tag/v1.4).

After compiling you can post here your score!
Welcome into QB64 community