Hello Guest it is March 28, 2024, 01:23:02 PM

Author Topic: Making a pushbutton control in Mach CB work  (Read 3068 times)

0 Members and 1 Guest are viewing this topic.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Making a pushbutton control in Mach CB work
« on: March 08, 2013, 10:07:37 PM »
Hi ALL, I am working on a new file loader for MACh3 that uses images of afile to load gcode files. I am having trouble getting the Pushbutton"LoadGcode File" to work.  All the other componets work as needed.

From the screen you select the file from the listbox as you select the file the Program displays the IMAGE file on screen. when you find the correct file then you would push  the load G code file button and it will load a gcode file of the same name to mach3.

The part that I cannot get to function would be CASE 3. I cannot find a clear description as to HOW to get a pushButton to function as needed.

IF anyone has an idea or a suggestion please fill free to add to it to get it to work correctly.

(;-) TP



' Macro to select Gcode files by BMP picture
Sub DrawBitmapSample
    Dim MyList()
    Begin Dialog BitmapDlg 60, 60, 590, 420, "Select Gcode FIle VIA BMP Image", .DlgFunc
   
        ListBox 10, 10, 80, 180, MyList(), .List1, 2
        Picture 100, 10, 480, 380, "c:\mach3\bitmaps\splash.bmp", 0, .Picture1
        CancelButton 25, 198, 40, 12     
        'OKButton 50, 198, 40, 12
        PushButton 10,225,80,12 , " Load G Code File ", .PB1
    End Dialog
   
     
     Dim frame As BitmapDlg
     ' Show the bitmap dialog
    Dialog frame
End Sub
 
Function DlgFunc( controlID As String, action As Integer, suppValue As Integer)
 
    DlgFunc = 1  ' Keep dialog active
 
    Select Case action
    Case 1 ' Initialize
        temp = Dir( "D:\ScamData\Jobs\*.bmp" )
        count = 0
        While temp <> ""
            count = count + 1
            temp = Dir
        Wend
        Dim x() As String
        ReDim x(count)
        x(0) = Dir( "D:\ScamData\Jobs\*.bmp" )
        For i = 1 To count
            x(i) = Dir
        Next i
        DlgListBoxArray "List1", x()
         
    Case 2 ' Click
        Fname = ( "D:\ScamData\Jobs\" & DlgText("List1") )
        DlgSetPicture "Picture1", Fname
   
     
       
    Case 3 ' select File to load from Image
   
     
  If button = 1 Then
 

 
sFile = Dlgtext("List1")
sFile = Left(sFile, InStr(1, sFile, ".") - 1)
Fext= ".TAP"
Lfile = sFile &Fext
If Dir ("C:\Mach3\Gcode\" & Lfile) ="" Then
MsgBox" File Does NOT Exist "
Message"Function Closed"
End

Else
 
Loadfile "C:\Mach3\Gcode\" &Lfile
 
End If
 End If
       
 End Select
End Function
End       

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Making a pushbutton control in Mach CB work
« Reply #1 on: March 09, 2013, 12:17:18 PM »
OK when I look at if from 100 miles away(;-) I saw the problem and have it running correctly now.

(;-) TP

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Making a pushbutton control in Mach CB work
« Reply #2 on: March 09, 2013, 12:50:36 PM »
Here is what Load from BMP function screen looks like.

(;-) TP

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Making a pushbutton control in Mach CB work
« Reply #3 on: March 11, 2013, 11:15:38 AM »
Very Nice TP!   :)

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!