Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Bible Flash Cards

  1. #11
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: Bible Flash Cards

    hi mark

    a) have done a short test, nice and good example you've done, I like that ! Do you have used ListviewCheckbox or Treeview features or both combined, anything else ?

    b) missing "close" button in your start ui

    c) perhaps there is a little mistake in your example focussed Line "337", I have got one error message after my second test. but I am not sure.

    good luck for your project !

    best regards, frank
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  2. #12
    Member marcuslee's Avatar
    Join Date
    Sep 2008
    Location
    Kansas, USA
    Age
    42
    Posts
    222
    Rep Power
    38

    Re: Bible Flash Cards

    Quote Originally Posted by Lionheart008
    a) have done a short test, nice and good example you've done, I like that ! Do you have used ListviewCheckbox or Treeview features or both combined, anything else ?
    It is a tree view. The check box is simulated. It is an ImageList.

    b) missing "close" button in your start ui
    Well, there is the button in the top right corner of the window. Even the new version that I have attached has that. Though it doesn't have a Max or Min button. So, I am not sure what you mean. Do you think I need to put another button inside the dialog for the user?

    c) perhaps there is a little mistake in your example focussed Line "337", I have got one error message after my second test. but I am not sure.
    Well, I don't know what is on line 337 since the program has changed. I was getting an error message with my Deck() array, but I didn't get it all the time, so I ignored it. Or, I may have solved it. I don't really know.

    If you know what you did to get the error message, try it with this version attached. Maybe we will solve it together.

    Here's the source code (the support files are included in the attachment):

    [code=thinbasic]
    Uses "UI"
    Uses "File"
    '---Constant declarations
    Begin Const
    %ID_Button_01 = %IDOK
    %ID_Label_01
    %ID_Button_02
    %ID_Button_03
    %ID_Button_04
    %ID_Button_05
    %ID_Label_02
    %ID_Label_03
    %ID_MenuTREE
    End Const

    Type FlashCard
    Front As ASCIIZ * 400
    Back As ASCIIZ * 400
    Quoted As ASCIIZ * 17
    BibleBook As ASCIIZ * 16
    Format As ASCIIZ * 19
    End Type

    'Arrays and Array Assignments
    Dim Deck() As DWord

    'Global Declarations
    Dim hFont1 As DWord Resource = Font_Create("Arial Black", 12)
    Dim hFont2 As DWord Resource = Font_Create("Arial Black", 16)
    Dim LabelText As String = "Choose a Deck of Flash Cards"
    Dim hDlg, hDlg2 As DWord
    Dim Result As Byte
    Dim CardNumber As Integer = 3
    Dim MaxCardNumber As Integer
    Dim FileName As String = APP_SourcePath & "FlashCards.DAT"
    Dim File As DWord = FILE_Open (FileName, "random" , SIZEOF (FlashCard))
    Dim SingleCard As FlashCard
    Dim BackUpCard As FlashCard
    Dim RandomCard As Integer
    Dim WhichSide As Byte = 1
    Dim CardCounter As DWord = 1
    Dim LastArrayItem As DWord
    Dim cPink As Long = RGB(255, 0, 255) '---Color for image transparency
    Dim EasyVerse(10) As DWord
    Dim HardVerse(10) As DWord
    Dim RandomCards(3) As DWord
    Dim hTreeItem As DWord
    Dim hRoot As DWord

    '------------------------------------------------------------------------------
    ' Program start point
    '------------------------------------------------------------------------------
    Function TBMain() As Long
    '---Create and load image list
    Global iList As Long = ImageList_New(ICON, 16, 16, 32)
    Global PicA As Long = ImageList_Add MASKED, iList, APP_SourcePath & "Icons\testa.bmp" , cPink
    Global PicB As Long = ImageList_Add MASKED, iList, APP_SourcePath & "Icons\testb.bmp" ', cPink
    Global PicC As Long = ImageList_Add MASKED, iList, APP_SourcePath & "Icons\testc.bmp" ', cPink
    Global PicD As Long = ImageList_Add MASKED, iList, APP_SourcePath & "Icons\testd.bmp" ', cPink

    Dialog NEW PIXELS, 0, "New World Translation Flash Cards", -1, -1, 600, 400,%WS_DLGFRAME | _
    %DS_CENTER | _
    %WS_CAPTION | _
    %WS_SYSMENU, %WS_EX_STATICEDGE To hDlg
    Dialog NEW PIXELS, 0, "New World Translation Flash Cards", -1, -1, 800, 400, _
    %WS_DLGFRAME | _
    %DS_CENTER | _
    %WS_CAPTION | _
    %WS_SYSMENU, %WS_EX_STATICEDGE To hDlg2
    '---Set window minimum size
    Dialog SET MINSIZE hDlg, 600, 400
    Dialog SET MINSIZE hDlg2, 800, 400
    Dialog SHOW MODAL hDlg, Call cbDialog
    End Function

    '------------------------------------------------------------------------------
    ' Callback procedure for main window
    '------------------------------------------------------------------------------
    CallBack Function cbDialog() As Long
    Select Case CBMSG
    Case %WM_INITDIALOG
    Control ADD TREEVIEW, CBHNDL, %ID_MenuTREE, "", 100, 50, 400, 285, _
    %WS_CHILD | _
    %WS_VISIBLE | _
    %TVS_HASBUTTONS | _
    %TVS_HASLINES | _
    %TVS_LINESATROOT | _
    %TVS_SHOWSELALWAYS , _
    %WS_EX_CLIENTEDGE, Call cbTreeView
    TreeView_SetImageList CBHNDL, %ID_MenuTREE, iList
    hRoot = TreeView_InsertItem CBHNDL, %ID_MenuTREE, 0, %TVI_FIRST,PicD ,PicD , "Full Verse Flash Cards"
    RandomCards(1) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, hRoot, %TVI_LAST,PicC ,PicC , "Decks of Random Cards"
    RandomCards(2) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, RandomCards(1), %TVI_LAST,PicA ,PicB , "10 Random Cards (Genesis - Deuteronomy)"
    RandomCards(3) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, RandomCards(1), %TVI_LAST,PicA ,PicB , "25 Random Cards (Genesis - Deuteronomy)"
    EasyVerse(1) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, hRoot, %TVI_LAST,PicC ,PicC , "Easier Verses"
    EasyVerse(2) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, EasyVerse(1), %TVI_LAST, PicA , PicB , "Genesis"
    EasyVerse(3) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, EasyVerse(1), %TVI_LAST, PicA , PicB , "Exodus"
    EasyVerse(4) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, EasyVerse(1), %TVI_LAST, PicA , PicB , "Leviticus, Numbers, and Deuteronomy"
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, EasyVerse(1), %FALSE
    HardVerse(1) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, hRoot, %TVI_LAST, PicC , PicC , "Somewhat Harder Verses"
    HardVerse(2) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, HardVerse(1), %TVI_LAST, PicA , PicB , "Genesis"
    HardVerse(3) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, HardVerse(1), %TVI_LAST, PicA , PicB , "Exodus"
    HardVerse(4) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, HardVerse(1), %TVI_LAST, PicA , PicB , "Leviticus & Numbers"
    HardVerse(5) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, HardVerse(1), %TVI_LAST, PicA , PicB , "Deuteronomy"
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, HardVerse(1), %FALSE
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, hRoot, %TRUE
    '---Add controls
    Control ADD BUTTON, CBHNDL, %ID_Button_01, "OK", 250, 350, 100, 35, %BS_NOTIFY | %WS_TABSTOP, , Call cbButton()
    Control ADD LABEL, CBHNDL, %ID_Label_01, LabelText, 0, 10, 600, 40 ,%SS_NOTIFY | %SS_CENTER
    'Set the font
    Control SEND CBHNDL, %ID_Label_01, %WM_SETFONT, hFont2, 0
    Control SEND CBHNDL, %ID_Button_01, %WM_SETFONT, hFont1, 0
    End Select
    End Function

    CallBack Function cbDialog2() As Long
    Select Case CBMSG
    Case %WM_INITDIALOG
    '---Add controls
    Control ADD BUTTON, CBHNDL, %ID_Button_05, "Start Over", 95, 300, 150, 35, %BS_NOTIFY | %WS_TABSTOP, Call cbButton2
    Control ADD BUTTON, CBHNDL, %ID_Button_02, "Previous Card",250, 300, 150, 35, %BS_NOTIFY | %WS_TABSTOP, Call cbButton2
    Control ADD BUTTON, CBHNDL, %ID_Button_03, "Next Card", 405, 300, 150, 35, %BS_NOTIFY | %WS_TABSTOP, Call cbButton2
    Control ADD BUTTON, CBHNDL, %ID_Button_04, "Flip Card", 560, 300, 150, 35, %BS_NOTIFY | %WS_TABSTOP, Call cbButton2
    Control ADD LABEL, CBHNDL, %ID_Label_01, LabelText, 75, 40, 650, 50 ,%SS_NOTIFY | %SS_CENTER , , Call cbLabel2
    Control ADD LABEL, CBHNDL, %ID_Label_02, "", 75, 100, 650, 160,%SS_NOTIFY ,%WS_EX_TRANSPARENT, Call cbLabel2
    Control ADD LABEL, CBHNDL, %ID_Label_03, "", 0, 350, 200, 50 ,%SS_NOTIFY | %SS_CENTER , , Call cbLabel2
    ' Setting the font for labels and textboxes
    Control SEND CBHNDL, %ID_Label_01, %WM_SETFONT, hFont2, 0
    Control SEND CBHNDL, %ID_Label_02, %WM_SETFONT, hFont1, 0
    Control SEND CBHNDL, %ID_Button_02, %WM_SETFONT, hFont1, 0
    Control SEND CBHNDL, %ID_Button_03, %WM_SETFONT, hFont1, 0
    Control SEND CBHNDL, %ID_Button_04, %WM_SETFONT, hFont1, 0
    Control SEND CBHNDL, %ID_Button_05, %WM_SETFONT, hFont1, 0
    'Show the first flash card
    Call EmptyCard() To Result
    Call ShowCard() To Result
    Control SET TEXT CBHNDL, %ID_Label_03, "Number of Verses: " & LastArrayItem
    Case %WM_DESTROY
    ImageList_Kill(iList)
    End Select
    End Function

    CallBack Function cbTreeView() As Long
    Local nmTV As NM_TREEVIEW PTR
    Select Case CBMSG
    Case %WM_NOTIFY
    '---Get the pointer of treeview notification structure
    nmTV = CBNMHDR
    '---Check what happen
    Select Case nmTV.hdr.Code
    Case %TVN_SELCHANGED
    hTreeItem = TreeView_GetSelect(CBHNDL,%ID_MenuTREE)
    Select Case hTreeItem
    Case hRoot
    TreeView_Select CBHNDL,%ID_MenuTREE, 0
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, hRoot, %TRUE
    Case EasyVerse(1)
    TreeView_Select CBHNDL,%ID_MenuTREE, 0
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, EasyVerse(1), %TRUE
    Case HardVerse(1)
    TreeView_Select CBHNDL,%ID_MenuTREE, 0
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, HardVerse(1), %TRUE
    End Select
    End Select
    End Select
    End Function

    CallBack Function cbButton() As Long
    If CBMSG = %WM_COMMAND Then
    Select Case CBCTLMSG
    Case %BN_CLICKED
    Select Case CBCTL
    Case %ID_Button_01
    hTreeItem = TreeView_GetSelect(CBHNDL,%ID_MenuTREE)
    If hTreeItem <> 0 Then Call GetContents() To Result
    End Select
    End Select
    Function = %TRUE
    End If
    End Function

    CallBack Function cbButton2() As Long
    If CBMSG = %WM_COMMAND Then
    Select Case CBCTLMSG
    Case %BN_CLICKED
    Select Case CBCTL
    Case %ID_Button_02
    Call PreviousCard() To Result
    Case %ID_Button_03
    Call NextCard() To Result
    Case %ID_Button_04
    Call FlipCard() To Result
    Case %ID_Button_05
    Dialog End hdlg2
    LabelText = "Choose a Deck of Flash Cards"
    Call TBMain() To Result
    End Select
    End Select
    Function = %TRUE
    End If
    End Function

    CallBack Function cbLabel2() As Long
    If CBMSG = %WM_COMMAND Then
    Select Case CBCTLMSG
    Case %STN_CLICKED
    Select Case CBCTL
    Case %ID_Label_02
    Call FlipCard() To Result
    End Select
    Case %STN_DBLCLK
    Select Case CBCTL
    Case %ID_Label_02
    Call ShowCard() To Result
    End Select
    End Select
    Function = %TRUE
    End If
    End Function

    Function GetContents() As Long
    Local ChosenDeck As DWord
    ChosenDeck = TreeView_GetSelect(hdlg,%ID_MenuTREE)
    Select Case ChosenDeck
    Case RandomCards(2)
    ReDim Deck(154)
    Deck(1) = 1,2,3,4,5,6,7,8,9,10,11,16,19,20,29,34,35,36, _
    40,41,42,59,60,61,62,63,64,65,66,67,68,71,72, _
    73,75,76,81,84,87,92,102,103,107,112,118,119,120,123,124, _
    128,129,130,132,136,139,140,141,148,149,150,153, _
    12,13,14,15,17,18,21,22,23,24,25,26,27,28,30,31,32,33,37,38,39, _
    43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,69,70, _
    74,77,78,79,80,82,83,85,88,89,90,93,94,95,96,97,98,99,100,86, _
    101,104,105,106,108,109,110,111,113,114,115,116,117,121,122,91, _
    125,126,127,131,133,134,135,137,138,142,143,144,145,146,147, _
    151,152,154
    Array Shuffle Deck For 100000
    ReDim Preserve Deck(10)
    Case RandomCards(3)
    ReDim Deck(154)
    Deck(1) = 1,2,3,4,5,6,7,8,9,10,11,16,19,20,29,34,35,36, _
    40,41,42,59,60,61,62,63,64,65,66,67,68,71,72, _
    73,75,76,81,84,87,92,102,103,107,112,118,119,120,123,124, _
    128,129,130,132,136,139,140,141,148,149,150,153, _
    12,13,14,15,17,18,21,22,23,24,25,26,27,28,30,31,32,33,37,38,39, _
    43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,69,70, _
    74,77,78,79,80,82,83,85,88,89,90,93,94,95,96,97,98,99,100,86, _
    101,104,105,106,108,109,110,111,113,114,115,116,117,121,122,91, _
    125,126,127,131,133,134,135,137,138,142,143,144,145,146,147, _
    151,152,154
    Array Shuffle Deck For 100000
    ReDim Preserve Deck(25)
    Case EasyVerse(2)'Genesis
    ReDim Deck(1
    Deck(1) = 1,2,3,4,5,6,7,8,9,10,11,16,19,20,29,34,35,36
    Case EasyVerse(3)'Exodus
    ReDim Deck(15)
    Deck(1) = 40,41,42,59,60,61,62,63,64,65,66,67,68,71,72
    Case EasyVerse(4)'Leviticus, Numbers, and Deuteronomy
    ReDim Deck(2
    Deck(1) = 73,75,76,81,84,87,92,102,103,107,112,118,119,120,123,124, _
    128,129,130,132,136,139,140,141,148,149,150,153
    Case HardVerse(2)'Genesis Non Familiar
    ReDim Deck(21)
    Deck(1) = 12,13,14,15,17,18,21,22,23,24,25,26,27,28,30,31,32,33,37,38,39
    Case HardVerse(3)'Exodus
    ReDim Deck(1
    Deck(1) = 43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,69,70
    Case HardVerse(4)'Leviticus and Numbers
    ReDim Deck(36)
    Deck(1) = 74,77,78,79,80,82,83,85,88,89,90,93,94,95,96,97,98,99,100,86, _
    101,104,105,106,108,109,110,111,113,114,115,116,117,121,122,91
    Case HardVerse(5)'Deuteronomy
    ReDim Deck(1
    Deck(1) = 125,126,127,131,133,134,135,137,138,142,143,144,145,146,147, _
    151,152,154
    End Select
    LastArrayItem = UBound(Deck)
    Array Shuffle Deck
    'This next line may be changed so that hDlg is hidden not ended.
    Dialog End hdlg
    LabelText = "New World Translation Flash Cards"
    Dialog SHOW MODAL hDlg2, Call cbDialog2
    Function = %TRUE
    End Function

    Function NextCard() As Long
    'Goes to the next card
    If CardCounter = LastArrayItem Then
    CardCounter = 1
    Else
    CardCounter = CardCounter + 1
    End If

    Call ShowCard() To Result

    Function = %TRUE
    End Function

    Function PreviousCard() As Long
    'Goes to the previous card
    If CardCounter = 1 Then
    CardCounter = LastArrayItem
    Else
    CardCounter = CardCounter - 1
    End If

    Call ShowCard() To Result

    Function = %TRUE
    End Function

    Function FlipCard() As Long
    If WhichSide = 1 Then
    Control SET TEXT hdlg2, %ID_Label_02, Trim$(SingleCard.Back)
    WhichSide = 2
    Else
    Control SET TEXT hdlg2, %ID_Label_02, String$(5, Chr$(32)) & Trim$(SingleCard.Front)
    WhichSide = 1
    End If
    Function = %TRUE
    End Function

    Function ShowCard() As Long
    CardNumber = Deck(CardCounter)
    FILE_GetR (File, CardNumber, SingleCard)
    Control SET TEXT hdlg2, %ID_Label_02, String$(5, Chr$(32)) & Trim$(SingleCard.Front)
    Function=%TRUE
    End Function

    Function EmptyCard() As Long
    'Brings up the first empty flash card

    MaxCardNumber = 1
    Do
    FILE_GetR (File, MaxCardNumber, BackUpCard)
    If BackUpCard.Front = "" Then
    Exit Do
    Else
    MaxCardNumber = MaxCardNumber + 1
    End If
    Loop
    MaxCardNumber = MaxCardNumber - 1
    Function=%TRUE
    End Function
    [/code]




    Mark
    Attached Files Attached Files

  3. #13
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: Bible Flash Cards

    hi mark, checked fast you new example, I will try to help. there are still one or two error message(s) for me and try to fix it (for example "array suffle deck" and "Ubound deck" and some other values are not 100 percent perfect, some arrays are not dimensioned). thanks for code but it takes a while, because I am at the afternoon out of house for two days. in order to live real family life and take a breath of sport, nature and love

    try to activate per mouse "decks of random cards" and push "ok" so here I get the error message: "variable not dimensioned, array shuffle deck", see my picture below...

    [code=thinbasic]
    Uses "UI"
    Uses "File"
    '---Constant declarations
    Begin Const
    %ID_Button_01 = %IDOK
    %ID_CLOSE
    %ID_Label_01
    %ID_Button_02
    %ID_Button_03
    %ID_Button_04
    %ID_Button_05
    %ID_Label_02
    %ID_Label_03
    %ID_MenuTREE
    End Const

    Type FlashCard
    Front As ASCIIZ * 400
    Back As ASCIIZ * 400
    Quoted As ASCIIZ * 17
    BibleBook As ASCIIZ * 16
    Format As ASCIIZ * 19
    End Type

    'Arrays and Array Assignments
    Dim Deck() As DWord

    'Global Declarations
    Dim hFont1 As DWord Resource = Font_Create("Arial Black", 12)
    Dim hFont2 As DWord Resource = Font_Create("Arial Black", 16)
    Dim LabelText As String = "Choose a Deck of Flash Cards"
    Dim hDlg, hDlg2 As DWord
    Dim Result As Byte
    Dim CardNumber As Integer = 3
    Dim MaxCardNumber As Integer
    Dim FileName As String = APP_SourcePath & "FlashCards.DAT"
    Dim File As DWord = FILE_Open (FileName, "random" , SIZEOF (FlashCard))
    Dim SingleCard As FlashCard
    Dim BackUpCard As FlashCard
    Dim RandomCard As Integer
    Dim WhichSide As Byte = 1
    Dim CardCounter As DWord = 1
    Dim LastArrayItem As DWord
    Dim cPink As Long = RGB(255, 0, 255) '---Color for image transparency
    Dim EasyVerse(10) As DWord
    Dim HardVerse(10) As DWord
    Dim RandomCards(3) As DWord
    Dim hTreeItem As DWord
    Dim hRoot As DWord

    '------------------------------------------------------------------------------
    ' Program start point
    '------------------------------------------------------------------------------
    Function TBMain() As Long
    '---Create and load image list
    Global iList As Long = ImageList_New(ICON, 16, 16, 32)
    Global PicA As Long = ImageList_Add MASKED, iList, APP_SourcePath & "Icons\testa.bmp" , cPink
    Global PicB As Long = ImageList_Add MASKED, iList, APP_SourcePath & "Icons\testb.bmp" ', cPink
    Global PicC As Long = ImageList_Add MASKED, iList, APP_SourcePath & "Icons\testc.bmp" ', cPink
    Global PicD As Long = ImageList_Add MASKED, iList, APP_SourcePath & "Icons\testd.bmp" ', cPink

    Dialog NEW PIXELS, 0, "New World Translation Flash Cards", -1, -1, 600, 400,%WS_DLGFRAME | _
    %DS_CENTER | _
    %WS_CAPTION | _
    %WS_SYSMENU, %WS_EX_STATICEDGE To hDlg
    Dialog NEW PIXELS, 0, "New World Translation Flash Cards", -1, -1, 800, 400, _
    %WS_DLGFRAME | _
    %DS_CENTER | _
    %WS_CAPTION | _
    %WS_SYSMENU, %WS_EX_STATICEDGE To hDlg2
    '---Set window minimum size
    Dialog SET MINSIZE hDlg, 600, 400
    Dialog SET MINSIZE hDlg2, 800, 400
    Dialog SHOW MODAL hDlg, Call cbDialog
    End Function

    '------------------------------------------------------------------------------
    ' Callback procedure for main window
    '------------------------------------------------------------------------------
    CallBack Function cbDialog() As Long
    Select Case CBMSG
    Case %WM_INITDIALOG
    Control ADD TREEVIEW, CBHNDL, %ID_MenuTREE, "", 100, 50, 400, 285, _
    %WS_CHILD | _
    %WS_VISIBLE | _
    %TVS_HASBUTTONS | _
    %TVS_HASLINES | _
    %TVS_LINESATROOT | _
    %TVS_SHOWSELALWAYS , _
    %WS_EX_CLIENTEDGE, Call cbTreeView
    TreeView_SetImageList CBHNDL, %ID_MenuTREE, iList
    hRoot = TreeView_InsertItem CBHNDL, %ID_MenuTREE, 0, %TVI_FIRST,PicD ,PicD , "Full Verse Flash Cards"
    RandomCards(1) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, hRoot, %TVI_LAST,PicC ,PicC , "Decks of Random Cards"
    RandomCards(2) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, RandomCards(1), %TVI_LAST,PicA ,PicB , "10 Random Cards (Genesis - Deuteronomy)"
    RandomCards(3) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, RandomCards(1), %TVI_LAST,PicA ,PicB , "25 Random Cards (Genesis - Deuteronomy)"
    EasyVerse(1) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, hRoot, %TVI_LAST,PicC ,PicC , "Easier Verses"
    EasyVerse(2) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, EasyVerse(1), %TVI_LAST, PicA , PicB , "Genesis"
    EasyVerse(3) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, EasyVerse(1), %TVI_LAST, PicA , PicB , "Exodus"
    EasyVerse(4) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, EasyVerse(1), %TVI_LAST, PicA , PicB , "Leviticus, Numbers, and Deuteronomy"
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, EasyVerse(1), %FALSE
    HardVerse(1) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, hRoot, %TVI_LAST, PicC , PicC , "Somewhat Harder Verses"
    HardVerse(2) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, HardVerse(1), %TVI_LAST, PicA , PicB , "Genesis"
    HardVerse(3) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, HardVerse(1), %TVI_LAST, PicA , PicB , "Exodus"
    HardVerse(4) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, HardVerse(1), %TVI_LAST, PicA , PicB , "Leviticus & Numbers"
    HardVerse(5) = TreeView_InsertItem CBHNDL, %ID_MenuTREE, HardVerse(1), %TVI_LAST, PicA , PicB , "Deuteronomy"
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, HardVerse(1), %FALSE
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, hRoot, %TRUE
    '---Add controls
    Control ADD BUTTON, CBHNDL, %ID_Button_01, "OK", 270, 350, 100, 35, %BS_NOTIFY | %WS_TABSTOP, , Call cbButton()
    Control ADD BUTTON, CBHNDL, %ID_CLOSE, "CLOSE", 170, 350, 100, 35, %BS_NOTIFY | %WS_TABSTOP, , Call closeme()
    Control ADD LABEL, CBHNDL, %ID_Label_01, LabelText, 0, 10, 600, 40 ,%SS_NOTIFY | %SS_CENTER
    'Set the font
    Control SEND CBHNDL, %ID_Label_01, %WM_SETFONT, hFont2, 0
    Control SEND CBHNDL, %ID_Button_01, %WM_SETFONT, hFont1, 0
    End Select
    End Function

    CallBack Function cbDialog2() As Long
    Select Case CBMSG
    Case %WM_INITDIALOG
    '---Add controls
    Control ADD BUTTON, CBHNDL, %ID_Button_05, "Start Over", 95, 300, 150, 35, %BS_NOTIFY | %WS_TABSTOP, Call cbButton2
    Control ADD BUTTON, CBHNDL, %ID_Button_02, "Previous Card",250, 300, 150, 35, %BS_NOTIFY | %WS_TABSTOP, Call cbButton2
    Control ADD BUTTON, CBHNDL, %ID_Button_03, "Next Card", 405, 300, 150, 35, %BS_NOTIFY | %WS_TABSTOP, Call cbButton2
    Control ADD BUTTON, CBHNDL, %ID_Button_04, "Flip Card", 560, 300, 150, 35, %BS_NOTIFY | %WS_TABSTOP, Call cbButton2
    Control ADD LABEL, CBHNDL, %ID_Label_01, LabelText, 75, 40, 650, 50 ,%SS_NOTIFY | %SS_CENTER , , Call cbLabel2
    Control ADD LABEL, CBHNDL, %ID_Label_02, "", 75, 100, 650, 160,%SS_NOTIFY ,%WS_EX_TRANSPARENT, Call cbLabel2
    Control ADD LABEL, CBHNDL, %ID_Label_03, "", 0, 350, 200, 50 ,%SS_NOTIFY | %SS_CENTER , , Call cbLabel2
    ' Setting the font for labels and textboxes
    Control SEND CBHNDL, %ID_Label_01, %WM_SETFONT, hFont2, 0
    Control SEND CBHNDL, %ID_Label_02, %WM_SETFONT, hFont1, 0
    Control SEND CBHNDL, %ID_Button_02, %WM_SETFONT, hFont1, 0
    Control SEND CBHNDL, %ID_Button_03, %WM_SETFONT, hFont1, 0
    Control SEND CBHNDL, %ID_Button_04, %WM_SETFONT, hFont1, 0
    Control SEND CBHNDL, %ID_Button_05, %WM_SETFONT, hFont1, 0
    'Show the first flash card
    Call EmptyCard() To Result
    Call ShowCard() To Result
    Control SET TEXT CBHNDL, %ID_Label_03, "Number of Verses: " & LastArrayItem
    Case %WM_DESTROY
    ImageList_Kill(iList)
    End Select
    End Function

    CallBack Function cbTreeView() As Long
    Local nmTV As NM_TREEVIEW PTR
    Select Case CBMSG
    Case %WM_NOTIFY
    '---Get the pointer of treeview notification structure
    nmTV = CBNMHDR
    '---Check what happen
    Select Case nmTV.hdr.Code
    Case %TVN_SELCHANGED
    hTreeItem = TreeView_GetSelect(CBHNDL,%ID_MenuTREE)
    Select Case hTreeItem
    Case hRoot
    TreeView_Select CBHNDL,%ID_MenuTREE, 0
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, hRoot, %TRUE
    Case EasyVerse(1)
    TreeView_Select CBHNDL,%ID_MenuTREE, 0
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, EasyVerse(1), %TRUE
    Case HardVerse(1)
    TreeView_Select CBHNDL,%ID_MenuTREE, 0
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, HardVerse(1), %TRUE
    End Select
    End Select
    End Select
    End Function

    CallBack Function cbButton() As Long
    If CBMSG = %WM_COMMAND Then
    Select Case CBCTLMSG
    Case %BN_CLICKED
    Select Case CBCTL
    Case %ID_Button_01
    hTreeItem = TreeView_GetSelect(CBHNDL,%ID_MenuTREE)
    If hTreeItem <> 0 Then Call GetContents() To Result
    End Select
    End Select
    Function = %TRUE
    End If
    End Function

    CallBack Function cbButton2() As Long
    If CBMSG = %WM_COMMAND Then
    Select Case CBCTLMSG
    Case %BN_CLICKED
    Select Case CBCTL
    Case %ID_Button_02
    Call PreviousCard() To Result
    Case %ID_Button_03
    Call NextCard() To Result
    Case %ID_Button_04
    Call FlipCard() To Result
    Case %ID_Button_05
    Dialog End hdlg2
    LabelText = "Choose a Deck of Flash Cards"
    Call TBMain() To Result
    End Select
    End Select
    Function = %TRUE
    End If
    End Function

    CallBack Function cbLabel2() As Long
    If CBMSG = %WM_COMMAND Then
    Select Case CBCTLMSG
    Case %STN_CLICKED
    Select Case CBCTL
    Case %ID_Label_02
    Call FlipCard() To Result
    End Select
    Case %STN_DBLCLK
    Select Case CBCTL
    Case %ID_Label_02
    Call ShowCard() To Result
    End Select
    End Select
    Function = %TRUE
    End If
    End Function

    Function GetContents() As Long
    Local times As Long
    Local ChosenDeck As DWord
    ChosenDeck = TreeView_GetSelect(hdlg,%ID_MenuTREE)
    Select Case ChosenDeck
    Case RandomCards(2)
    ReDim Deck(154)
    Deck(1) = 1,2,3,4,5,6,7,8,9,10,11,16,19,20,29,34,35,36, _
    40,41,42,59,60,61,62,63,64,65,66,67,68,71,72, _
    73,75,76,81,84,87,92,102,103,107,112,118,119,120,123,124, _
    128,129,130,132,136,139,140,141,148,149,150,153, _
    12,13,14,15,17,18,21,22,23,24,25,26,27,28,30,31,32,33,37,38,39, _
    43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,69,70, _
    74,77,78,79,80,82,83,85,88,89,90,93,94,95,96,97,98,99,100,86, _
    101,104,105,106,108,109,110,111,113,114,115,116,117,121,122,91, _
    125,126,127,131,133,134,135,137,138,142,143,144,145,146,147, _
    151,152,154
    Array Shuffle Deck For 100000
    ReDim Preserve Deck(10)
    Case RandomCards(3)
    ReDim Deck(154)
    Deck(1) = 1,2,3,4,5,6,7,8,9,10,11,16,19,20,29,34,35,36, _
    40,41,42,59,60,61,62,63,64,65,66,67,68,71,72, _
    73,75,76,81,84,87,92,102,103,107,112,118,119,120,123,124, _
    128,129,130,132,136,139,140,141,148,149,150,153, _
    12,13,14,15,17,18,21,22,23,24,25,26,27,28,30,31,32,33,37,38,39, _
    43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,69,70, _
    74,77,78,79,80,82,83,85,88,89,90,93,94,95,96,97,98,99,100,86, _
    101,104,105,106,108,109,110,111,113,114,115,116,117,121,122,91, _
    125,126,127,131,133,134,135,137,138,142,143,144,145,146,147, _
    151,152,154
    Array Shuffle Deck For 100000
    ReDim Preserve Deck(25)
    Case EasyVerse(2)'Genesis
    ReDim Deck(1
    Deck(1) = 1,2,3,4,5,6,7,8,9,10,11,16,19,20,29,34,35,36
    Case EasyVerse(3)'Exodus
    ReDim Deck(15)
    Deck(1) = 40,41,42,59,60,61,62,63,64,65,66,67,68,71,72
    Case EasyVerse(4)'Leviticus, Numbers, and Deuteronomy
    ReDim Deck(2
    Deck(1) = 73,75,76,81,84,87,92,102,103,107,112,118,119,120,123,124, _
    128,129,130,132,136,139,140,141,148,149,150,153
    Case HardVerse(2)'Genesis Non Familiar
    ReDim Deck(21)
    Deck(1) = 12,13,14,15,17,18,21,22,23,24,25,26,27,28,30,31,32,33,37,38,39
    Case HardVerse(3)'Exodus
    ReDim Deck(1
    Deck(1) = 43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,69,70
    Case HardVerse(4)'Leviticus and Numbers
    ReDim Deck(36)
    Deck(1) = 74,77,78,79,80,82,83,85,88,89,90,93,94,95,96,97,98,99,100,86, _
    101,104,105,106,108,109,110,111,113,114,115,116,117,121,122,91
    Case HardVerse(5)'Deuteronomy
    ReDim Deck(1
    Deck(1) = 125,126,127,131,133,134,135,137,138,142,143,144,145,146,147, _
    151,152,154
    End Select

    '-xxx ---------------------------------------------------------------------------

    '-- frank: Local deck(154) As Long
    '-- frank: LastArrayItem = UBound(Deck(154))
    '-- Array Shuffle Deck(1) For 100000 times
    LastArrayItem = UBound(Deck)
    Array Shuffle Deck
    'Array Shuffle ArrayVariable[([StartIndex])] [For nTimes]
    '-xxx ---------------------------------------------------------------------------

    'This next line may be changed so that hDlg is hidden not ended.
    Dialog End hdlg
    LabelText = "New World Translation Flash Cards"
    Dialog SHOW MODAL hDlg2, Call cbDialog2
    Function = %TRUE
    End Function

    Function NextCard() As Long
    'Goes to the next card
    If CardCounter = LastArrayItem Then
    CardCounter = 1
    Else
    CardCounter = CardCounter + 1
    End If

    Call ShowCard() To Result

    Function = %TRUE
    End Function

    Function PreviousCard() As Long
    'Goes to the previous card
    If CardCounter = 1 Then
    CardCounter = LastArrayItem
    Else
    CardCounter = CardCounter - 1
    End If

    Call ShowCard() To Result

    Function = %TRUE
    End Function

    Function FlipCard() As Long
    If WhichSide = 1 Then
    Control SET TEXT hdlg2, %ID_Label_02, Trim$(SingleCard.Back)
    WhichSide = 2
    Else
    Control SET TEXT hdlg2, %ID_Label_02, String$(5, Chr$(32)) & Trim$(SingleCard.Front)
    WhichSide = 1
    End If
    Function = %TRUE
    End Function

    Function ShowCard() As Long
    CardNumber = Deck(CardCounter)
    FILE_GetR (File, CardNumber, SingleCard)
    Control SET TEXT hdlg2, %ID_Label_02, String$(5, Chr$(32)) & Trim$(SingleCard.Front)
    Function=%TRUE
    End Function

    Function EmptyCard() As Long
    'Brings up the first empty flash card

    MaxCardNumber = 1
    Do
    FILE_GetR (File, MaxCardNumber, BackUpCard)
    If BackUpCard.Front = "" Then
    Exit Do
    Else
    MaxCardNumber = MaxCardNumber + 1
    End If
    Loop
    MaxCardNumber = MaxCardNumber - 1
    Function=%TRUE
    End Function


    CallBack Function closeme()
    Select Case CBMSG
    Case %WM_COMMAND
    Select Case CBCTL
    Case %ID_CLOSE
    If CBCTLMSG = %BN_CLICKED Then
    Dialog End CBHNDL
    End If
    End Select
    End Select

    End Function
    [/code]

    I am not quite sure, but there will be some more fixes to do more to come, have a good day, frank (out now !)
    Attached Images Attached Images
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  4. #14

    Re: Bible Flash Cards

    Franck, when you attach screenshots, can you make them in a little bigger screensolution? I can not read the small stuff.

  5. #15
    Member marcuslee's Avatar
    Join Date
    Sep 2008
    Location
    Kansas, USA
    Age
    42
    Posts
    222
    Rep Power
    38

    Re: Bible Flash Cards

    Quote Originally Posted by Lionheart008
    try to activate per mouse "decks of random cards" and push "ok" so here I get the error message: "variable not dimensioned, array shuffle deck", see my picture below...
    Thank You!

    That told me exactly where the problem was. That item in the treeview isn't suppose to be selectable. Just like the "Easier Verses" and the "Somewhat Harder Verses." So, I added this code to the callback function of the tree view:

    [code=thinbasic]
    Case RandomCards(1)
    TreeView_Select CBHNDL,%ID_MenuTREE, 0
    TreeView_SetExpanded CBHNDL, %ID_MenuTREE, RandomCards(1), %TRUE
    [/code]

    The Deck() array wasn't dimensioned because I hadn't told the computer what to do with RandomCards(1), that first line of the Random Deck of Cards section.

    It probably would have taken me a long time to find that error because it is one of those things that I wouldn't have been looking for. Thank you.

    I also noticed that you added a CLOSE button, but I didn't see a closeme() callback function. Plus, I would probably just put it in the cbButton() callback function, anyway. Thanks for the suggestion, though.


    Mark


Page 2 of 2 FirstFirst 12

Similar Threads

  1. Flash guardian
    By Petr Schreiber in forum thinBasic General
    Replies: 4
    Last Post: 01-03-2009, 19:04

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •