Jump to content
Sign in to follow this  
Cor

Help needed with moving a line

Recommended Posts

Cor

How to move the line $hLineCursor below to the right and erasing the previous line

The $GUI_GR_MOVE will not draw only point to other cursor point.

I can for sure delete the first line and draw it on other coordinate, but ,maybe there are other ways?

edit: and how to delete this line:

$hLineCursor=GUICtrlSetGraphic($hTabBorder,$GUI_GR_RECT, 40,30,1,240); vertical line

Suggestions are welcome

$hTabBorder=GuiCtrlCreateGraphic(8, 10, 790,300); white background
; draw edit line
GUICtrlSetGraphic($hTabBorder,$GUI_GR_PENSIZE,1)
GUICtrlSetGraphic($hTabBorder,$GUI_GR_COLOR, 0x66cc99); green
$hLineCursor=GUICtrlSetGraphic($hTabBorder,$GUI_GR_RECT, 40,30,1,240); vertical line

edit: GUICtrlDelete($hLineCursor) is not working

grCor

Edited by Cor

gr.Corhttp://www.ready4music.com35+ programs for ...

Share this post


Link to post
Share on other sites
Cor

Maybe a little example will help, it's an extraction of my guitar licks practice program

which can slow down music to learn guitar solos's (this is already working ;-).

Click link below for picture of my program

Guitar Licks Program

No I want to implent tab notation, so if you want to learn a guitar solo then you can directly save it in

tab notation form.

The green line must be moved by the left and right arrow keys

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

$Form = GUICreate("Guitar Licks", 803, 585, 121, 52)

; -----------  Set Events
GUISetOnEvent($GUI_EVENT_CLOSE, "DoEventClose")
;------------  Set events

DrawTabLines()

GUISetState(@SW_SHOW)

; --------- idle loop
While 1
    Sleep(1000)
WEnd
; --------- idle loop

;---------------------------------
; Close Form
;---------------------------------
Func DoEventClose()
if  @GUI_Winhandle=$Form then
 exit
endif
EndFunc

Func DrawTabLines()
; ----------------- draw tab lines ----------------------
$hTabBorder=GuiCtrlCreateGraphic(8, 10, 790,300)
GUICtrlSetBkColor($hTabBorder,0xffffff)
GUICtrlSetGraphic($hTabBorder,$GUI_GR_PENSIZE,1)
GUICtrlSetColor($hTabBorder,0)
for $tablines= 30 to 105 step 15
 GUICtrlSetGraphic($hTabBorder,$GUI_GR_RECT, 10,$tablines,770,1)
next

for $tablines= 195 to 270 step 15
 GUICtrlSetGraphic($hTabBorder,$GUI_GR_RECT, 10,$tablines,770,1)
next

; draw vertical lines
GUICtrlSetGraphic($hTabBorder,$GUI_GR_PENSIZE,2)
; draw left line
GUICtrlSetGraphic($hTabBorder,$GUI_GR_RECT, 10,30,1,240)
; draw right line
GUICtrlSetGraphic($hTabBorder,$GUI_GR_RECT, 780,30,1,240)

;$hLblDraw=GUICtrlCreateLabel("Ring",20,35,50,15)
;GUICtrlSetColor($hLblDraw,0xff)
;GUICtrlSetBKColor($hLblDraw,$GUI_BKCOLOR_TRANSPARENT )

; draw edit line
$line=GUICtrlCreateGraphic(40,30,1,240)
GUICtrlSetGraphic($line,$GUI_GR_PENSIZE,2)
GUICtrlSetGraphic($line,$GUI_GR_COLOR, 0x66cc99); green
$hLineCursor=GUICtrlSetGraphic($line,$GUI_GR_RECT, 40,10,1,240)
;GUICtrlSetGraphic($hLineCursor,$GUI_GR_COLOR, 0x66cc99); green
;GUICtrlSetBKColor($hLineCursor,$GUI_BKCOLOR_TRANSPARENT )
    

EndFunc

How to move the line $hLineCursor below to the right and erasing the previous line

The $GUI_GR_MOVE will not draw only point to other cursor point.

I can for sure delete the first line and draw it on other coordinate, but ,maybe there are other ways?

edit: and how to delete this line:

$hLineCursor=GUICtrlSetGraphic($hTabBorder,$GUI_GR_RECT, 40,30,1,240); vertical line

Suggestions are welcome

$hTabBorder=GuiCtrlCreateGraphic(8, 10, 790,300); white background
; draw edit line
GUICtrlSetGraphic($hTabBorder,$GUI_GR_PENSIZE,1)
GUICtrlSetGraphic($hTabBorder,$GUI_GR_COLOR, 0x66cc99); green
$hLineCursor=GUICtrlSetGraphic($hTabBorder,$GUI_GR_RECT, 40,30,1,240); vertical line

edit: GUICtrlDelete($hLineCursor) is not working

grCor

Edited by Cor

gr.Corhttp://www.ready4music.com35+ programs for ...

Share this post


Link to post
Share on other sites
GaryFrost

Why not just use a label?

i.e.

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

Dim $left = 40, $top = 40, $line

$Form = GUICreate("Guitar Licks", 803, 585, 121, 52)

; -----------  Set Events
GUISetOnEvent($GUI_EVENT_CLOSE, "DoEventClose")
HotKeySet("{RIGHT}", "_MoveRight")
;------------  Set events

DrawTabLines()

GUISetState(@SW_SHOW)

; --------- idle loop
While 1
    Sleep(1000)
WEnd
; --------- idle loop

;---------------------------------
; Close Form
;---------------------------------
Func DoEventClose()
    If @GUI_WinHandle = $Form Then
        Exit
    EndIf
EndFunc   ;==>DoEventClose

Func _MoveRight()
    $left += 10
    GUICtrlSetPos($line, $left, $top)
EndFunc   ;==>_MoveRight

Func DrawTabLines()
    ; ----------------- draw tab lines ----------------------
    $hTabBorder = GUICtrlCreateGraphic(8, 10, 790, 300)
    GUICtrlSetBkColor($hTabBorder, 0xffffff)
    GUICtrlSetGraphic($hTabBorder, $GUI_GR_PENSIZE, 1)
    GUICtrlSetColor($hTabBorder, 0)
    For $tablines = 30 To 105 Step 15
        GUICtrlSetGraphic($hTabBorder, $GUI_GR_RECT, 10, $tablines, 770, 1)
    Next

    For $tablines = 195 To 270 Step 15
        GUICtrlSetGraphic($hTabBorder, $GUI_GR_RECT, 10, $tablines, 770, 1)
    Next

    ; draw vertical lines
    GUICtrlSetGraphic($hTabBorder, $GUI_GR_PENSIZE, 2)
    ; draw left line
    GUICtrlSetGraphic($hTabBorder, $GUI_GR_RECT, 10, 30, 1, 240)
    ; draw right line
    GUICtrlSetGraphic($hTabBorder, $GUI_GR_RECT, 780, 30, 1, 240)

    ;$hLblDraw=GUICtrlCreateLabel("Ring",20,35,50,15)
    ;GUICtrlSetColor($hLblDraw,0xff)
    ;GUICtrlSetBKColor($hLblDraw,$GUI_BKCOLOR_TRANSPARENT )

    ; draw edit line
    $line = GUICtrlCreateLabel("", $left, 40, 1, 240)
    GUICtrlSetBkColor($line, 0x66cc99)
;~ $line=GUICtrlCreateGraphic(40,30,1,240)
;~ GUICtrlSetGraphic($line,$GUI_GR_PENSIZE,2)
;~ GUICtrlSetGraphic($line,$GUI_GR_COLOR, 0x66cc99); green
;~ $hLineCursor=GUICtrlSetGraphic($line,$GUI_GR_RECT, 40,10,1,240)
    ;GUICtrlSetGraphic($hLineCursor,$GUI_GR_COLOR, 0x66cc99); green
    ;GUICtrlSetBKColor($hLineCursor,$GUI_BKCOLOR_TRANSPARENT )


EndFunc   ;==>DrawTabLines

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.