Jump to content
Sign in to follow this  
microera

GUI problem (slider2 and RadioButton not work)?

Recommended Posts

microera

Hi

Why in example:

http://freeweb.siol.net/js1234//IRrec01d.au3

Slider2 and RadioButton "Server" dont work

?

but in example:

http://freeweb.siol.net/js1234//IRrec01.au3

work all!

It seems that lower region (arround slider2 and radio button 'server') not work at all?

Where is problem?

I check differences but I ispect many hours and problems still exists...... ;)

Share this post


Link to post
Share on other sites
microera

Why

_GDIPlus_GraphicsDrawLine($hDC, 16, 254, 16, 304, $hPen)

see: _PLOT_signal($aTimeVectors1, $x_GUIstart, $y_GUIstart, 1000)

not draw the line?

p.s.

I remove moste of code and make only one line, wich not work.... ;)

#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <GuiStatusBar.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <SendMessage.au3> ;Needed for _SendMessage function.
#include <ProgressConstants.au3>
#Include <File.au3>
#include <Array.au3>
#include <GDIPlus.au3>

Global $const150=150, $const2=2
Dim $aRecords
Dim $aTimeVectors1[$const150][$const2]      ;iz aRecors bomo izluscili array signala iz microC
Dim $aTimeVectors2[$const150][$const2]      ;iz aRecors bomo izluscili array signala iz microC
Dim $aTimeVectors3[$const150][$const2]      ;iz aRecors bomo izluscili array signala iz microC
Dim $aTimeVectors4[$const150][$const2]      ;iz aRecors bomo izluscili array signala iz microC
Dim $aNewTimeVectors[$const150][$const2]

Global $x_GUIstart=16
Global $y_GUIstart
$y_GUIstart=216+88
Global $dif_GUI=96
Global $y_2GUIstart=$y_GUIstart+$dif_GUI
Global $y_3GUIstart=$y_2GUIstart+$dif_GUI
Global $y_4GUIstart=$y_3GUIstart+$dif_GUI

Global $ysizeS=50   ;10? ;y size of signal (pixels)


Global $varTimeArrayIndex = 0       ;od tukaj do $maxTimeArrayIndex se napolni novo polje-array
Global $maxTimeArrayIndex = 1000        ;var. se spreminja do max.
Global $varTimeSignalSAMPLE = 0     ;realna vrednost (dolo?a casovni SAMPLE) ali 0 ali 1
Global $indexVarTimeSignalSAMPLE=0  ;integer
Global $maxTimeSignal = 150000      ;for example (tole dobimo od microkontrolerja)
Global $varTime = 0                 ;realna vrednost  - tole povecujemo in primerjamo z varTimeSignal
Global $enotaArraySampleTime = 100  ;

Global $lokacijaPRVA, $LokacijaZADNJA, $maxTimeSignal

Dim $aIRrec1[$maxTimeArrayIndex+1][2]

Opt("GUIOnEventMode", 1)
Dim $TAB
#Region ### START Koda GUI section ### Form=d:\autoit\convert_array_graph\ir_recorder_v01.kxf
$Form1_1 = GUICreate("Microera IR recorder", 1035, 795, 195, 123)
$File = GUICtrlCreateMenu("&File"&@TAB&"Ctrl+F")
GUICtrlSetOnEvent(-1, "FileClick")
$MenuItem2 = GUICtrlCreateMenuItem("OpenLOG", $File, -1 , 1)
GUICtrlSetOnEvent(-1, "MenuItem2Click")
$MenuItem1 = GUICtrlCreateMenuItem("OpenINI", $File)
GUICtrlSetOnEvent(-1, "MenuItem1Click")
$MenuItem3 = GUICtrlCreateMenuItem("Exit", $File)
GUICtrlSetOnEvent(-1, "MenuItem3Click")
$MenuItem4 = GUICtrlCreateMenu("&Settings")
GUICtrlSetOnEvent(-1, "MenuItem4Click")
$MenuItem5 = GUICtrlCreateMenuItem("COM port", $MenuItem4)
GUICtrlSetOnEvent(-1, "MenuItem5Click")
$MenuItem7 = GUICtrlCreateMenu("&Help")
GUICtrlSetOnEvent(-1, "MenuItem7Click")
$MenuItem6 = GUICtrlCreateMenuItem("Help", $MenuItem7)
GUICtrlSetOnEvent(-1, "MenuItem6Click")
$MenuItem8 = GUICtrlCreateMenuItem("About", $MenuItem7)
GUICtrlSetOnEvent(-1, "MenuItem8Click")
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1_1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1_1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1_1Restore")
$Pic1 = GUICtrlCreatePic("D:\AutoIt\convert_ARRay_Graph\IRrecorder.jpg", 152, 0, 348, 100)
GUICtrlSetOnEvent(-1, "Pic1Click")
$MonthCal1 = GUICtrlCreateMonthCal("2010/06/29", 832, 8, 192, 177)
GUICtrlSetOnEvent(-1, "MonthCal1Change")
$Graphic1 = GUICtrlCreateGraphic($x_GUIstart, $y_GUIstart, 1000, 88)
GUICtrlSetOnEvent(-1, "Graphic1Click")
$Graphic2 = GUICtrlCreateGraphic($x_GUIstart, $y_2GUIstart, 1000, 88)
GUICtrlSetOnEvent(-1, "Graphic2Click")
$Graphic3 = GUICtrlCreateGraphic($x_GUIstart, $y_3GUIstart, 1000, 88)
GUICtrlSetOnEvent(-1, "Graphic3Click")
$Graphic4 = GUICtrlCreateGraphic($x_GUIstart, $y_4GUIstart, 1000, 88)
GUICtrlSetOnEvent(-1, "Graphic4Click")
$Label1 = GUICtrlCreateLabel("Click on Graph to ZOOM!", 32, 712, 124, 17)
GUICtrlSetOnEvent(-1, "Label1Click")
$IPAddress1 = _GUICtrlIpAddress_Create($Form1_1, 728, 688, 130, 21)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
$Label4 = GUICtrlCreateLabel("PORT", 864, 696, 34, 17)
GUICtrlSetOnEvent(-1, "Label4Click")
$Radio1 = GUICtrlCreateRadio("Client", 744, 728, 113, 17)
GUICtrlSetOnEvent(-1, "Radio1Click")
$Radio2 = GUICtrlCreateRadio("Server", 744, 664, 113, 17)
GUICtrlSetOnEvent(-1, "Radio2Click")
$Label3 = GUICtrlCreateLabel("Connected_Not Connected", 742, 712, 132, 17)
GUICtrlSetOnEvent(-1, "Label3Click")
$Label5 = GUICtrlCreateLabel("T=", 568, 35, 45, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "Label5Click")
$f38 = GUICtrlCreateInput("f38", 104, 176, 33, 21)
GUICtrlSetOnEvent(-1, "f38Change")
$Label11 = GUICtrlCreateLabel("kHz", 144, 180, 23, 17)
GUICtrlSetOnEvent(-1, "Label11Click")
$Button1 = GUICtrlCreateButton("Set Fmod.:", 16, 172, 83, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
$Label12 = GUICtrlCreateLabel(":C", 671, 35, 38, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "Label12Click")
$Button2 = GUICtrlCreateButton("PING", 904, 688, 51, 25)
GUICtrlSetOnEvent(-1, "Button2Click")
$Slider1 = GUICtrlCreateSlider(592, 160, 200, 45)
GUICtrlSetOnEvent(-1, "Slider1Change")
$Label2 = GUICtrlCreateLabel("X amplifier ZOOM", 600, 136, 87, 17)
GUICtrlSetOnEvent(-1, "Label2Click")
$Slider2 = GUICtrlCreateSlider(8, 608, 1000, 45)
;$Slider2 = GUICtrlCreateSlider(8, 660, 1000, 45)
GUICtrlSetOnEvent(-1, "Slider2Change")
$Button3 = GUICtrlCreateButton("SaveSCREEN", 248, 720, 75, 25)
GUICtrlSetOnEvent(-1, "Button3Click")
$Button4 = GUICtrlCreateButton("Save1234", 328, 720, 75, 25)
GUICtrlSetOnEvent(-1, "Button4Click")
$Button5 = GUICtrlCreateButton("1", 408, 720, 35, 25)
GUICtrlSetOnEvent(-1, "Button5Click")
$Button6 = GUICtrlCreateButton("2", 448, 720, 35, 25)
GUICtrlSetOnEvent(-1, "Button6Click")
$Button7 = GUICtrlCreateButton("3", 487, 721, 35, 25)
GUICtrlSetOnEvent(-1, "Button7Click")
$Button8 = GUICtrlCreateButton("4", 527, 721, 35, 25)
GUICtrlSetOnEvent(-1, "Button8Click")
$Label6 = GUICtrlCreateLabel("1", 0, 256, 10, 17)
GUICtrlSetOnEvent(-1, "Label6Click")
$Label7 = GUICtrlCreateLabel("2", 0, 352, 10, 17)
GUICtrlSetOnEvent(-1, "Label7Click")
$Label8 = GUICtrlCreateLabel("3", 0, 448, 10, 17)
GUICtrlSetOnEvent(-1, "Label8Click")
$Label9 = GUICtrlCreateLabel("4", 0, 544, 10, 17)
GUICtrlSetOnEvent(-1, "Label9Click")
GUISetState(@SW_SHOW)
Dim $Form1_1_AccelTable[1][2] = [["^f", $File]]
GUISetAccelerators($Form1_1_AccelTable)
#EndRegion ### END Koda GUI section ###

;===============================================================================================================



    _PLOT_signal($aTimeVectors1, $x_GUIstart, $y_GUIstart, 1000)    



;===============================================================================================================    begin loop

While 1
    Sleep(100)
WEnd

;===============================================================================================================   end loop
Func Button1Click()

EndFunc
Func Button2Click()

EndFunc
Func Button3Click()

EndFunc
Func Button4Click()

EndFunc
Func Button5Click()

EndFunc
Func Button6Click()

EndFunc
Func Button7Click()

EndFunc
Func Button8Click()

EndFunc
Func f38Change()

EndFunc
Func FileClick()

EndFunc
Func Form1_1Close()

EndFunc
Func Form1_1Maximize()

EndFunc
Func Form1_1Minimize()

EndFunc
Func Form1_1Restore()

EndFunc
Func Graphic1Click()

EndFunc
Func Graphic2Click()

EndFunc
Func Graphic3Click()

EndFunc
Func Graphic4Click()

EndFunc
Func Label11Click()

EndFunc
Func Label12Click()

EndFunc
Func Label1Click()

EndFunc
Func Label2Click()

EndFunc
Func Label3Click()

EndFunc
Func Label4Click()

EndFunc
Func Label5Click()

EndFunc
Func Label6Click()

EndFunc
Func Label7Click()

EndFunc
Func Label8Click()

EndFunc
Func Label9Click()

EndFunc
Func MenuItem1Click()

EndFunc

Func MenuItem2Click()   ;File ... Open LOG

            
EndFunc

Func MenuItem3Click()   ;File ... Exit
    _Exit()
EndFunc
Func MenuItem4Click()

EndFunc
Func MenuItem5Click()

EndFunc
Func MenuItem6Click()

EndFunc
Func MenuItem7Click()

EndFunc
Func MenuItem8Click()   ;About
        MsgBox(4096,"About ", " IR recorder/analayzer v0.2e")   ;02d,02e bom vrgel ven WinAPI ter dal notri GDIplus 17.8.2010/18,8,2010
EndFunc
Func MonthCal1Change()

EndFunc
Func Pic1Click()

EndFunc
Func Radio1Click()

EndFunc
Func Radio2Click()

EndFunc
Func Slider1Change()

EndFunc
Func Slider2Change()

EndFunc



;======================================================================================================
;$aTimeVectors=2 dim array with signal times (col0 =low signal time, col1=high sihnal time)
; $maxX = max X pixel time (example 1000)
Func _PLOT_signal($arrayTimeVectors, $startingX, $startingY, $maxX) ;, $Xdivisor)

    local $varX, $varXX
    local $ii
    local $Y_high
    local $Y_low
    local $divisorTime
    local $maxXRealTime ; $maxXRealTime = max signal time (example 205000 us) from uC

    _EnterGUI()

    _GDIPlus_GraphicsDrawLine($hDC, 16, 254, 16, 304, $hPen) ; prva planka je vedno negativna

    Sleep(500) ; show cross over screen for defined seconds
    _ExitGUI()


EndFunc   ;==>_PLOT_signal
;======================================================================================================

Func _Exit()
    ; clear resources
    if $bGUIactive Then
        _ExitGUI()
    EndIf
    Exit
EndFunc

Func _ExitGUI()
    _GDIPlus_PenDispose ($hPen)
    _GDIPlus_GraphicsDispose ($hDC)
    _GDIPlus_Shutdown ()    
    $bGUIactive=0
EndFunc

;init graphic------------
Func _EnterGUI()
    Global $hDC, $hPen, $obj_orig
    Global $hPenFrame=0,  $obj_origF
    Global $widthPEN=1
    Global $color=0xFF
    Global  $bGUIactive
        _GDIPlus_Startup ()
        $hDC = _GDIPlus_GraphicsCreateFromHWND ($Form1_1)
        $hPen = _GDIPlus_PenCreate ()       ;_GDIPlus_PenCreate([$iARGB = 0xFF000000[, $nWidth = 1[, $iUnit = 2]]])
        $bGUIactive=1
        GUISetState(@SW_SHOW)
EndFunc
Edited by microera

Share this post


Link to post
Share on other sites
microera

and shortest example .......

WHY THIS EXAMPLE DRAW LINE ON WRONG POSITION?

#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <GuiStatusBar.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <SendMessage.au3> ;Needed for _SendMessage function.
#include <ProgressConstants.au3>
#Include <File.au3>
#include <Array.au3>
#include <GDIPlus.au3>

Global $x_GUIstart=16
Global $y_GUIstart
$y_GUIstart=216+88
Global $dif_GUI=96
Global $y_2GUIstart=$y_GUIstart+$dif_GUI
Global $y_3GUIstart=$y_2GUIstart+$dif_GUI
Global $y_4GUIstart=$y_3GUIstart+$dif_GUI

Global $ysizeS=50   ;10? ;y size of signal (pixels)


Opt("GUIOnEventMode", 1)
Dim $TAB
#Region ### START Koda GUI section ### Form=d:\autoit\convert_array_graph\ir_recorder_v01.kxf
$Form1_1 = GUICreate("Microera IR recorder", 1035, 795, 195, 123)
$File = GUICtrlCreateMenu("&File"&@TAB&"Ctrl+F")
GUICtrlSetOnEvent(-1, "FileClick")
$MenuItem2 = GUICtrlCreateMenuItem("OpenLOG", $File, -1 , 1)
GUICtrlSetOnEvent(-1, "MenuItem2Click")
$MenuItem1 = GUICtrlCreateMenuItem("OpenINI", $File)
GUICtrlSetOnEvent(-1, "MenuItem1Click")
$MenuItem3 = GUICtrlCreateMenuItem("Exit", $File)
GUICtrlSetOnEvent(-1, "MenuItem3Click")
$MenuItem4 = GUICtrlCreateMenu("&Settings")
GUICtrlSetOnEvent(-1, "MenuItem4Click")
$MenuItem5 = GUICtrlCreateMenuItem("COM port", $MenuItem4)
GUICtrlSetOnEvent(-1, "MenuItem5Click")
$MenuItem7 = GUICtrlCreateMenu("&Help")
GUICtrlSetOnEvent(-1, "MenuItem7Click")
$MenuItem6 = GUICtrlCreateMenuItem("Help", $MenuItem7)
GUICtrlSetOnEvent(-1, "MenuItem6Click")
$MenuItem8 = GUICtrlCreateMenuItem("About", $MenuItem7)
GUICtrlSetOnEvent(-1, "MenuItem8Click")
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1_1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1_1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1_1Restore")
$Pic1 = GUICtrlCreatePic("D:\AutoIt\convert_ARRay_Graph\IRrecorder.jpg", 152, 0, 348, 100)
GUICtrlSetOnEvent(-1, "Pic1Click")
$MonthCal1 = GUICtrlCreateMonthCal("2010/06/29", 832, 8, 192, 177)
GUICtrlSetOnEvent(-1, "MonthCal1Change")
$Graphic1 = GUICtrlCreateGraphic($x_GUIstart, $y_GUIstart, 1000, 88)
GUICtrlSetOnEvent(-1, "Graphic1Click")
$Graphic2 = GUICtrlCreateGraphic($x_GUIstart, $y_2GUIstart, 1000, 88)
GUICtrlSetOnEvent(-1, "Graphic2Click")
$Graphic3 = GUICtrlCreateGraphic($x_GUIstart, $y_3GUIstart, 1000, 88)
GUICtrlSetOnEvent(-1, "Graphic3Click")
$Graphic4 = GUICtrlCreateGraphic($x_GUIstart, $y_4GUIstart, 1000, 88)
GUICtrlSetOnEvent(-1, "Graphic4Click")
$Label1 = GUICtrlCreateLabel("Click on Graph to ZOOM!", 32, 712, 124, 17)
GUICtrlSetOnEvent(-1, "Label1Click")
$IPAddress1 = _GUICtrlIpAddress_Create($Form1_1, 728, 688, 130, 21)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
$Label4 = GUICtrlCreateLabel("PORT", 864, 696, 34, 17)
GUICtrlSetOnEvent(-1, "Label4Click")
$Radio1 = GUICtrlCreateRadio("Client", 744, 728, 113, 17)
GUICtrlSetOnEvent(-1, "Radio1Click")
$Radio2 = GUICtrlCreateRadio("Server", 744, 664, 113, 17)
GUICtrlSetOnEvent(-1, "Radio2Click")
$Label3 = GUICtrlCreateLabel("Connected_Not Connected", 742, 712, 132, 17)
GUICtrlSetOnEvent(-1, "Label3Click")
$Label5 = GUICtrlCreateLabel("T=", 568, 35, 45, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "Label5Click")
$f38 = GUICtrlCreateInput("f38", 104, 176, 33, 21)
GUICtrlSetOnEvent(-1, "f38Change")
$Label11 = GUICtrlCreateLabel("kHz", 144, 180, 23, 17)
GUICtrlSetOnEvent(-1, "Label11Click")
$Button1 = GUICtrlCreateButton("Set Fmod.:", 16, 172, 83, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
$Label12 = GUICtrlCreateLabel(":C", 671, 35, 38, 41)
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "Label12Click")
$Button2 = GUICtrlCreateButton("PING", 904, 688, 51, 25)
GUICtrlSetOnEvent(-1, "Button2Click")
$Slider1 = GUICtrlCreateSlider(592, 160, 200, 45)
GUICtrlSetOnEvent(-1, "Slider1Change")
$Label2 = GUICtrlCreateLabel("X amplifier ZOOM", 600, 136, 87, 17)
GUICtrlSetOnEvent(-1, "Label2Click")
$Slider2 = GUICtrlCreateSlider(8, 608, 1000, 45)
;$Slider2 = GUICtrlCreateSlider(8, 660, 1000, 45)
GUICtrlSetOnEvent(-1, "Slider2Change")
$Button3 = GUICtrlCreateButton("SaveSCREEN", 248, 720, 75, 25)
GUICtrlSetOnEvent(-1, "Button3Click")
$Button4 = GUICtrlCreateButton("Save1234", 328, 720, 75, 25)
GUICtrlSetOnEvent(-1, "Button4Click")
$Button5 = GUICtrlCreateButton("1", 408, 720, 35, 25)
GUICtrlSetOnEvent(-1, "Button5Click")
$Button6 = GUICtrlCreateButton("2", 448, 720, 35, 25)
GUICtrlSetOnEvent(-1, "Button6Click")
$Button7 = GUICtrlCreateButton("3", 487, 721, 35, 25)
GUICtrlSetOnEvent(-1, "Button7Click")
$Button8 = GUICtrlCreateButton("4", 527, 721, 35, 25)
GUICtrlSetOnEvent(-1, "Button8Click")
$Label6 = GUICtrlCreateLabel("1", 0, 256, 10, 17)
GUICtrlSetOnEvent(-1, "Label6Click")
$Label7 = GUICtrlCreateLabel("2", 0, 352, 10, 17)
GUICtrlSetOnEvent(-1, "Label7Click")
$Label8 = GUICtrlCreateLabel("3", 0, 448, 10, 17)
GUICtrlSetOnEvent(-1, "Label8Click")
$Label9 = GUICtrlCreateLabel("4", 0, 544, 10, 17)
GUICtrlSetOnEvent(-1, "Label9Click")
GUISetState(@SW_SHOW)
Dim $Form1_1_AccelTable[1][2] = [["^f", $File]]
GUISetAccelerators($Form1_1_AccelTable)
#EndRegion ### END Koda GUI section ###

;===============================================================================================================

        _GDIPlus_Startup ()
        $hDC = _GDIPlus_GraphicsCreateFromHWND ($Form1_1)
        $hPen = _GDIPlus_PenCreate ()       ;_GDIPlus_PenCreate([$iARGB = 0xFF000000[, $nWidth = 1[, $iUnit = 2]]])
            _GDIPlus_GraphicsDrawLine($hDC, 10, 10, 100, 100, $hPen) 
        _GDIPlus_PenDispose ($hPen)
        _GDIPlus_GraphicsDispose ($hDC)
        _GDIPlus_Shutdown ()
    
    Sleep(2000)
    

;===============================================================================================================    begin loop

While 1
    Sleep(100)
WEnd

;===============================================================================================================   end loop

Func MenuItem3Click()   ;File ... Exit
    Exit
EndFunc

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.