Jump to content

idea for a guitar neck ui to remember notes.


sumit
 Share

Recommended Posts

Please get me started on this.

I desire to create a grid like ui

e.g = rows 6, columns 24

that should fit comfortably within the size of my screen

i would like each cell to be a radio button kind of ui element

the purpose of making this ui is to help remembering notes of guitar songs. ( for solo notes only not chords )

my idea is that as i read guitar tabs i click on each corresponding radio button

such that if i click 4 radio buttons in series - the neck should show last 3 radio buttons as selected

ie. when i click first radio - it should get selected

when second - 1st and 2nd should show selected

when third - 1st, 2nd and 3rd should show selected

when 4th - 2nd , 3rd and 4th should show selected.

regards,

sumit

Link to comment
Share on other sites

thanks

czardas

this thread looks great. when i saw it i started getting ideas on how i can modilfy my current idea. I am still however stuck at how to create a grid of radio buttons . can you help me with that .. there is no result in auto it help when i enter the term radio

rgds,

sumit

attaching an image of radio button grid i have in mind

post-25054-0-99023800-1360740015_thumb.j

Edited by sumit
Link to comment
Share on other sites

I'm a bit tired and busy, but I can perhaps give you some ideas with some similar GUI layouts.

Here is an example of a method for laying controls out in a grid (taken from a project I'm working on). If you have six strings then perhaps you should make each string a separate group using GUICtrlCreateGroup. You may want to lay the strings out vertically, so be careful of the position, and order in which, you create them.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ButtonConstants.au3>

_CTRL_Dialogue()

Func _CTRL_Dialogue($dDefault = 0xFFFFD9FF)
    Local $hChild = GUICreate("Strip Out Control Characters", 424, 126, Default, Default, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_TOPMOST)

    Local $iLeft = 10, $iTop = 6, $aCTRLCheckBox[32] = _
    ["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","HT","LF","VT","FF","CR","SO","SI","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","ESC","FS","GS","RS","US"]

    For $i = 0 To 31 ; Look at this code for laying out controls in a grid
        $aCTRLCheckBox[$i] = GUICtrlCreateCheckbox($aCTRLCheckBox[$i], $iLeft, $iTop, 40, 20)
        If Mod($i +1, 8) <> 0 Then
            $iLeft += 52
        Else
            $iLeft = 10
            $iTop += 23
        EndIf
    Next

    For $i = 0 To 30 ; Method only works for up to 31 controls because 2^31 <> -2147483648
        If BitAND($dDefault, 2^$i) = 2^$i Then GUICtrlSetState($aCTRLCheckBox[$i], $GUI_CHECKED)
    Next
    If BitAND($dDefault, 0x80000000) = 0x80000000 Then GUICtrlSetState($aCTRLCheckBox[31], $GUI_CHECKED)

    Local $aCTRLBtn[5] = ["Reset","Select All","Clear","Ok","Cancel"]
    $iTop += 2
    For $i = 0 To 4
        $aCTRLBtn[$i] = GUICtrlCreateButton($aCTRLBtn[$i], $iLeft, $iTop, 76, 20)
        $iLeft += 82
    Next
    GUICtrlSetState($aCTRLBtn[3], $GUI_DEFBUTTON)

    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE, $aCTRLBtn[4]
                ExitLoop
            Case $aCTRLBtn[0] ; Reset
                _SetCTRLCheckBoxes($aCTRLCheckBox, 0xFFFFD9FF)
            Case $aCTRLBtn[1] ; Select All
                _SetCTRLCheckBoxes($aCTRLCheckBox, 0xFFFFFFFF)
            Case $aCTRLBtn[2] ; Clear
                _SetCTRLCheckBoxes($aCTRLCheckBox, 0)
            Case $aCTRLBtn[3] ; Ok
                Local $dHex = _ReadCTRLCheckBoxes($aCTRLCheckBox)
                ConsoleWrite($dHex & @LF)
        EndSwitch
    WEnd
EndFunc

Func _SetCTRLCheckBoxes($aCTRLCheckBox, $dHex)
    For $i = 0 To 30 ; Method only works for up to 31 controls because 2^31 <> -2147483648
        GUICtrlSetState($aCTRLCheckBox[$i], $GUI_UNCHECKED)
        If BitAND($dHex, 2^$i) = 2^$i Then GUICtrlSetState($aCTRLCheckBox[$i], $GUI_CHECKED)
    Next
    GUICtrlSetState($aCTRLCheckBox[31], $GUI_UNCHECKED)
    If BitAND($dHex, 0x80000000) = 0x80000000 Then GUICtrlSetState($aCTRLCheckBox[31], $GUI_CHECKED)
EndFunc

Func _ReadCTRLCheckBoxes($aCTRLCheckBox)
    Local $dHex = 0x00000000
    For $i = 0 To 30 ; Method only works for up to 31 controls because 2^31 <> -2147483648
        If BitAND(GUICtrlRead($aCTRLCheckBox[$i]), $GUI_CHECKED) = $GUI_CHECKED Then $dHex = BitOR($dHex, 2^$i)
    Next
    If BitAND(GUICtrlRead($aCTRLCheckBox[31]), $GUI_CHECKED) = $GUI_CHECKED Then $dHex = BitOR($dHex, 0x80000000)
    Return $dHex
EndFunc

which uses a two dimensional array to lay out a grid of radio buttons. but the code is complicated. Creating a graphic version similar to the ones in the guitar chords thread is perhaps the most complicated thing to do.

For your radio button approach I strongly recommend using separate vertical groups of radio buttons for each string, unless you plan to write scales with multiple notes on one string, then radio buttons might not be the best choice.

Edited by czardas
Link to comment
Share on other sites

thats just enough for me to get started ... thanks a lot :)

I'm a bit tired and busy, but I can perhaps give you some ideas with some similar GUI layouts.

Here is an example of a method for laying controls out in a grid (taken from a project I'm working on). If you have six strings then perhaps you should make each string a separate group using GUICtrlCreateGroup. You may want to lay the strings out vertically, so be careful of the position, and order in which, you create them.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <ButtonConstants.au3>

_CTRL_Dialogue()

Func _CTRL_Dialogue($dDefault = 0xFFFFD9FF)
    Local $hChild = GUICreate("Strip Out Control Characters", 424, 126, Default, Default, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_TOPMOST)

    Local $iLeft = 10, $iTop = 6, $aCTRLCheckBox[32] = _
    ["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","HT","LF","VT","FF","CR","SO","SI","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","ESC","FS","GS","RS","US"]

    For $i = 0 To 31 ; Look at this code for laying out controls in a grid
        $aCTRLCheckBox[$i] = GUICtrlCreateCheckbox($aCTRLCheckBox[$i], $iLeft, $iTop, 40, 20)
        If Mod($i +1, 8) <> 0 Then
            $iLeft += 52
        Else
            $iLeft = 10
            $iTop += 23
        EndIf
    Next

    For $i = 0 To 30 ; Method only works for up to 31 controls because 2^31 <> -2147483648
        If BitAND($dDefault, 2^$i) = 2^$i Then GUICtrlSetState($aCTRLCheckBox[$i], $GUI_CHECKED)
    Next
    If BitAND($dDefault, 0x80000000) = 0x80000000 Then GUICtrlSetState($aCTRLCheckBox[31], $GUI_CHECKED)

    Local $aCTRLBtn[5] = ["Reset","Select All","Clear","Ok","Cancel"]
    $iTop += 2
    For $i = 0 To 4
        $aCTRLBtn[$i] = GUICtrlCreateButton($aCTRLBtn[$i], $iLeft, $iTop, 76, 20)
        $iLeft += 82
    Next
    GUICtrlSetState($aCTRLBtn[3], $GUI_DEFBUTTON)

    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE, $aCTRLBtn[4]
                ExitLoop
            Case $aCTRLBtn[0] ; Reset
                _SetCTRLCheckBoxes($aCTRLCheckBox, 0xFFFFD9FF)
            Case $aCTRLBtn[1] ; Select All
                _SetCTRLCheckBoxes($aCTRLCheckBox, 0xFFFFFFFF)
            Case $aCTRLBtn[2] ; Clear
                _SetCTRLCheckBoxes($aCTRLCheckBox, 0)
            Case $aCTRLBtn[3] ; Ok
                Local $dHex = _ReadCTRLCheckBoxes($aCTRLCheckBox)
                ConsoleWrite($dHex & @LF)
        EndSwitch
    WEnd
EndFunc

Func _SetCTRLCheckBoxes($aCTRLCheckBox, $dHex)
    For $i = 0 To 30 ; Method only works for up to 31 controls because 2^31 <> -2147483648
        GUICtrlSetState($aCTRLCheckBox[$i], $GUI_UNCHECKED)
        If BitAND($dHex, 2^$i) = 2^$i Then GUICtrlSetState($aCTRLCheckBox[$i], $GUI_CHECKED)
    Next
    GUICtrlSetState($aCTRLCheckBox[31], $GUI_UNCHECKED)
    If BitAND($dHex, 0x80000000) = 0x80000000 Then GUICtrlSetState($aCTRLCheckBox[31], $GUI_CHECKED)
EndFunc

Func _ReadCTRLCheckBoxes($aCTRLCheckBox)
    Local $dHex = 0x00000000
    For $i = 0 To 30 ; Method only works for up to 31 controls because 2^31 <> -2147483648
        If BitAND(GUICtrlRead($aCTRLCheckBox[$i]), $GUI_CHECKED) = $GUI_CHECKED Then $dHex = BitOR($dHex, 2^$i)
    Next
    If BitAND(GUICtrlRead($aCTRLCheckBox[31]), $GUI_CHECKED) = $GUI_CHECKED Then $dHex = BitOR($dHex, 0x80000000)
    Return $dHex
EndFunc

which uses a two dimensional array to lay out a grid of radio buttons. but the code is complicated. Creating a graphic version similar to the ones in the guitar chords thread is perhaps the most complicated thing to do.

For your radio button approach I strongly recommend using separate vertical groups of radio buttons for each string, unless you plan to write scales with multiple notes on one string, then radio buttons might not be the best choice.

thats enough for me to get started .

thanks a lot

rgds,

sumit

Link to comment
Share on other sites

there is no result in auto it help when i enter the term radio

I can assure you there are results. I just did a search myself to check.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Ah, that's when you know the actual name of the function. No problem then, at least you learnt something.

Edited by guinness

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

thats just enough for me to get started ... thanks a lot :)

thats enough for me to get started .

thanks a lot

rgds,

sumit

I hope it helps.The selection method using bitwise functions (BitAnd and BitOr) will only work for up to 32 controls in one grid. This is why I thought of grouping them, so you can use this method with more frets. Of course you can create the controls easily enough, it's when you come to read them that the method may become useful. It's not the only method, and it's certainly not essential to do it that way.

Edit

On reflection, it might be better to simply read each control in a loop without using bitwise functions. See how far you get and post the code if you get stuck.

Edited by czardas
Link to comment
Share on other sites

Thanks to help from

czardas

the UI part of the code is done. :)

#include 

Example()

Func Example()
Local $radio1, $radio2, $msg
GUICreate("Guitar Notes Memorizer", 1252, 146, Default, Default)


Local $iLeft = 10, $iTop = 6, $aCTRLCheckBox[144] = _
["1e","2e","3e","4e","5e","6e","7e","8e","9e","10e","11e","12e","13e","14e","15e","16e","17e","18e","19e","20e","21e","22e","23e","24e","1B","2B","3B","4B","5B","6B","7B","8B","9B","10B","11B","12B","13B","14B","15B","16B","17B","18B","19B","20B","21B","22B","23B","24B","1G","2G","3G","4G","5G","6G","7G","8G","9G","10G","11G","12G","13G","14G","15G","16G","17G","18G","19G","20G","21G","22G","23G","24G","1D","2D","3D","4D","5D","6D","7D","8D","9D","10D","11D","12D","13D","14D","15D","16D","17D","18D","19D","20D","21D","22D","23D","24D","1A","2A","3A","4A","5A","6A","7A","8A","9A","10A","11A","12A","13A","14A","15A","16A","17A","18A","19A","20A","21A","22A","23A","24A","1E","2E","3E","4E","5E","6E","7E","8E","9E","10E","11E","12E","13E","14E","15E","16E","17E","18E","19E","20E","21E","22E","23E","24E"]

For $i = 0 To 143 ; Look at this code for laying out controls in a grid
$aCTRLCheckBox[$i] = GUICtrlCreateRadio($aCTRLCheckBox[$i], $iLeft, $iTop, 40, 20)
If Mod($i +1, 24) <> 0 Then
$iLeft += 52
Else
$iLeft = 10
$iTop += 23
EndIf
Next


GUICtrlSetState($radio2, $GUI_CHECKED)

GUISetState() ; will display an dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
EndSelect
WEnd
EndFunc ;==>Example
Link to comment
Share on other sites

If the numbers are representative of frets, then you forgot the open strings.

thanks

JohnOne

exactly what i thought after posting above :) updated code below

#include 

Example()

Func Example()
Local $radio1, $radio2, $msg
GUICreate("Guitar Notes Memorizer", 1302, 146, Default, Default)


Local $iLeft = 10, $iTop = 6, $aCTRLCheckBox[150] = _
["0e","1e","2e","3e","4e","5e","6e","7e","8e","9e","10e","11e","12e","13e","14e","15e","16e","17e","18e","19e","20e","21e","22e","23e","24e","0B","1B","2B","3B","4B","5B","6B","7B","8B","9B","10B","11B","12B","13B","14B","15B","16B","17B","18B","19B","20B","21B","22B","23B","24B","0G","1G","2G","3G","4G","5G","6G","7G","8G","9G","10G","11G","12G","13G","14G","15G","16G","17G","18G","19G","20G","21G","22G","23G","24G","0D","1D","2D","3D","4D","5D","6D","7D","8D","9D","10D","11D","12D","13D","14D","15D","16D","17D","18D","19D","20D","21D","22D","23D","24D","0A","1A","2A","3A","4A","5A","6A","7A","8A","9A","10A","11A","12A","13A","14A","15A","16A","17A","18A","19A","20A","21A","22A","23A","24A","0E","1E","2E","3E","4E","5E","6E","7E","8E","9E","10E","11E","12E","13E","14E","15E","16E","17E","18E","19E","20E","21E","22E","23E","24E"]

For $i = 0 To 149 ; Look at this code for laying out controls in a grid
$aCTRLCheckBox[$i] = GUICtrlCreateRadio($aCTRLCheckBox[$i], $iLeft, $iTop, 40, 20)
If Mod($i +1, 25) <> 0 Then
$iLeft += 52
Else
$iLeft = 10
$iTop += 23
EndIf
Next


GUISetState() ; will display an dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
EndSelect
WEnd
EndFunc ;==>Example
Link to comment
Share on other sites

You can only click one radio button at once. You can't do chord shapes or scales (only one note at a time). If you used checkboxes instead you could click all of them. If you used groups as I mentioned earlier, you could have chords as shown below (plus some comments added):

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $radio1, $radio2, $msg
    Local $hGUI = GUICreate("Guitar Notes Memorizer", 1252, 146, Default, Default)


    Local $iLeft = 10, $iTop = 6, $aCTRLCheckBox[144] = _
    ["1e","2e","3e","4e","5e","6e","7e","8e","9e","10e","11e","12e","13e","14e","15e","16e","17e","18e","19e","20e","21e","22e","23e","24e","1B","2B","3B","4B","5B","6B","7B","8B","9B","10B","11B","12B","13B","14B","15B","16B","17B","18B","19B","20B","21B","22B","23B","24B","1G","2G","3G","4G","5G","6G","7G","8G","9G","10G","11G","12G","13G","14G","15G","16G","17G","18G","19G","20G","21G","22G","23G","24G","1D","2D","3D","4D","5D","6D","7D","8D","9D","10D","11D","12D","13D","14D","15D","16D","17D","18D","19D","20D","21D","22D","23D","24D","1A","2A","3A","4A","5A","6A","7A","8A","9A","10A","11A","12A","13A","14A","15A","16A","17A","18A","19A","20A","21A","22A","23A","24A","1E","2E","3E","4E","5E","6E","7E","8E","9E","10E","11E","12E","13E","14E","15E","16E","17E","18E","19E","20E","21E","22E","23E","24E"]

    GUIStartGroup () ; First string
    For $i = 0 To 143 ; Look at this code for laying out controls in a grid
        $aCTRLCheckBox[$i] = GUICtrlCreateRadio($aCTRLCheckBox[$i], $iLeft, $iTop, 40, 20)
        If Mod($i +1, 24) <> 0 Then
            $iLeft += 52
        Else
            GUIStartGroup () ; Next string
            $iLeft = 10
            $iTop += 23
        EndIf
    Next


    GUICtrlSetState($radio2, $GUI_CHECKED) ; Where is $radio2 created?

    GUISetState() ; will display an dialog box with 1 checkbox

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED ; ???
                MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
            Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
        EndSelect
    WEnd
EndFunc ;==>Example
Edited by czardas
Link to comment
Share on other sites

You can only click one radio button at once. You can't do chord shapes or scales (only one note at a time). If you used checkboxes instead you could click all of them. If you used groups as I mentioned earlier, you could have chords as shown below (plus some comments added):

#include <GUIConstantsEx.au3>

Example()

Func Example()
Local $radio1, $radio2, $msg
Local $hGUI = GUICreate("Guitar Notes Memorizer", 1252, 146, Default, Default)


Local $iLeft = 10, $iTop = 6, $aCTRLCheckBox[144] = _
["1e","2e","3e","4e","5e","6e","7e","8e","9e","10e","11e","12e","13e","14e","15e","16e","17e","18e","19e","20e","21e","22e","23e","24e","1B","2B","3B","4B","5B","6B","7B","8B","9B","10B","11B","12B","13B","14B","15B","16B","17B","18B","19B","20B","21B","22B","23B","24B","1G","2G","3G","4G","5G","6G","7G","8G","9G","10G","11G","12G","13G","14G","15G","16G","17G","18G","19G","20G","21G","22G","23G","24G","1D","2D","3D","4D","5D","6D","7D","8D","9D","10D","11D","12D","13D","14D","15D","16D","17D","18D","19D","20D","21D","22D","23D","24D","1A","2A","3A","4A","5A","6A","7A","8A","9A","10A","11A","12A","13A","14A","15A","16A","17A","18A","19A","20A","21A","22A","23A","24A","1E","2E","3E","4E","5E","6E","7E","8E","9E","10E","11E","12E","13E","14E","15E","16E","17E","18E","19E","20E","21E","22E","23E","24E"]

GUIStartGroup () ; First string
For $i = 0 To 143 ; Look at this code for laying out controls in a grid
$aCTRLCheckBox[$i] = GUICtrlCreateRadio($aCTRLCheckBox[$i], $iLeft, $iTop, 40, 20)
If Mod($i +1, 24) <> 0 Then
$iLeft += 52
Else
GUIStartGroup () ; Next string
$iLeft = 10
$iTop += 23
EndIf
Next


GUICtrlSetState($radio2, $GUI_CHECKED) ; Where is $radio2 created?

GUISetState() ; will display an dialog box with 1 checkbox

; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED ; ???
MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
EndSelect
WEnd
EndFunc ;==>Example

oh cool... i see that what you did makes this perfect for chords, but as i pointed out the idea i have is not for chords but melody practice

the problem when you create a group for each string then only one radio button can be checked per string at a time. this is perfect for the purpose of chords. i however am trying to allow " the last 3 radio buttons " in checked state even for the same string. And when the 4th radio button is clicked the 1st should get unchecked.

so grouping wont help in that i think .

Link to comment
Share on other sites

Three in a row? I think perhaps it would be easier to use check boxes as in my first example, unless someone has a better idea. You will need to write the code to control how they behave. You could also custom design some labels and make them clickable to make it look better, but first creating a prototype like this is fine.

Edited by czardas
Link to comment
Share on other sites

You will still need two strings to be highlighted at once.

My first thought for having the previous notes still hilighted (perhaps even to indicate a slide, would be to have each radio a control in its own right.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

My first thought for having the previous notes still hilighted (perhaps even to indicate a slide, would be to have each radio a control in its own right.

That will work. I'm not sure about the best way to do this, but creating a group before each radio seems to do the trick. I guess there are better methods, but I don't know them.

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $hGUI = GUICreate("Guitar Notes Memorizer", 1252, 146, Default, Default)

    Local $iLeft = 10, $iTop = 6, $aCTRLCheckBox[144] = _
    ["1e","2e","3e","4e","5e","6e","7e","8e","9e","10e","11e","12e","13e","14e","15e","16e","17e","18e","19e","20e","21e","22e","23e","24e","1B","2B","3B","4B","5B","6B","7B","8B","9B","10B","11B","12B","13B","14B","15B","16B","17B","18B","19B","20B","21B","22B","23B","24B","1G","2G","3G","4G","5G","6G","7G","8G","9G","10G","11G","12G","13G","14G","15G","16G","17G","18G","19G","20G","21G","22G","23G","24G","1D","2D","3D","4D","5D","6D","7D","8D","9D","10D","11D","12D","13D","14D","15D","16D","17D","18D","19D","20D","21D","22D","23D","24D","1A","2A","3A","4A","5A","6A","7A","8A","9A","10A","11A","12A","13A","14A","15A","16A","17A","18A","19A","20A","21A","22A","23A","24A","1E","2E","3E","4E","5E","6E","7E","8E","9E","10E","11E","12E","13E","14E","15E","16E","17E","18E","19E","20E","21E","22E","23E","24E"]

    For $i = 0 To 143
        GUIStartGroup () ; Create a group for each radio.
        $aCTRLCheckBox[$i] = GUICtrlCreateRadio($aCTRLCheckBox[$i], $iLeft, $iTop, 40, 20)
        If Mod($i +1, 24) <> 0 Then
            $iLeft += 52
        Else
            ; Next string
            $iLeft = 10
            $iTop += 23
        EndIf
    Next

    GUISetState() ; will display an dialog box

    Local $msg
    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd
EndFunc ;==>Example
Edited by czardas
Link to comment
Share on other sites

You don't really need two octaves (24 frets) along one string because the patterns in the second octave are the same notes repeated. 17 frets plus the open strings should be enough. 6 x 18.

That will work. I'm not sure about the best way to do this, but creating a group before each radio seems to do the trick. I guess there are better methods, but I don't know them.

#include <GUIConstantsEx.au3>

Example()

Func Example()
Local $hGUI = GUICreate("Guitar Notes Memorizer", 1252, 146, Default, Default)

Local $iLeft = 10, $iTop = 6, $aCTRLCheckBox[144] = _
["1e","2e","3e","4e","5e","6e","7e","8e","9e","10e","11e","12e","13e","14e","15e","16e","17e","18e","19e","20e","21e","22e","23e","24e","1B","2B","3B","4B","5B","6B","7B","8B","9B","10B","11B","12B","13B","14B","15B","16B","17B","18B","19B","20B","21B","22B","23B","24B","1G","2G","3G","4G","5G","6G","7G","8G","9G","10G","11G","12G","13G","14G","15G","16G","17G","18G","19G","20G","21G","22G","23G","24G","1D","2D","3D","4D","5D","6D","7D","8D","9D","10D","11D","12D","13D","14D","15D","16D","17D","18D","19D","20D","21D","22D","23D","24D","1A","2A","3A","4A","5A","6A","7A","8A","9A","10A","11A","12A","13A","14A","15A","16A","17A","18A","19A","20A","21A","22A","23A","24A","1E","2E","3E","4E","5E","6E","7E","8E","9E","10E","11E","12E","13E","14E","15E","16E","17E","18E","19E","20E","21E","22E","23E","24E"]

For $i = 0 To 143
GUIStartGroup () ; Create a group for each radio.
$aCTRLCheckBox[$i] = GUICtrlCreateRadio($aCTRLCheckBox[$i], $iLeft, $iTop, 40, 20)
If Mod($i +1, 24) <> 0 Then
$iLeft += 52
Else
; Next string
$iLeft = 10
$iTop += 23
EndIf
Next

GUISetState() ; will display an dialog box

Local $msg
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
EndFunc ;==>Example

Thanks a lot

czardas

this is almost complete with only the unchecking left to be implemented . You are right 17 frets + open fret should be enough, but i'll keep the 24 + open frets just for trying out more things in future,

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...