Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Tarak on May 19, 2013, 05:56:41 AM

Title: Dialog box that enters information into custom DRO's
Post by: Tarak on May 19, 2013, 05:56:41 AM
I've read heaps of posts regarding the use of a dialog box, but I can't for the life of me figure out the format for the following sequence to work:

1 Dialog box opens with multiple tools in the list (This works ok)
2 Select the item you want (This works ok)
3 Depending on the item selected, values are entered into custom DRO's (No idea how to complete this part)

This is the test code I am using (just from the manual):

Sub Main
Dim MyList$ (5)
MyList (0) = "line Item 1"
MyList (1) = "line Item 2"
MyList (2) = "line Item 3"
MyList (3) = "line Item 4"
MyList (4) = "line Item 5"
MyList (5) = "line Item 6"
Begin Dialog BoxSample 16,35,256,89,"Drop-Down List Box"
OKButton 204,24,40,14
CancelButton 204,44,40,14
DropListBox 124,24,72,40, MyList$( ),.DrpList
Text 124,12,68,8,"Drop-Down List Box:"
End Dialog
Dim Dlg1 As BoxSample
Button = Dialog ( Dlg1 )
End Sub

So ideally if "line Item 1" is selected it will enter the following data:
SetOEMDRO(1204,4)
SetOEMDRO(1205,4.15)
SetUserLED(1007,1)
SetUserLED(1008,1)
'Message "Line Item 1 Details Entered"       

If "line Item 2" is selected it will enter the following data:
SetOEMDRO(1204,10)
SetOEMDRO(1205,5.25)
SetUserLED(1007,1)
SetUserLED(1008,1)
'Message "Line Item 2 Details Entered"       

So on and so forth.

I've done a bit with the visual basic side of it, but really only the basics of onscreen buttons and leds.
Thanks
Darc
Title: Re: Dialog box that enters information into custom DRO's
Post by: poppabear on May 21, 2013, 07:07:08 AM
set up a case statement, depending on what value selected, that case will populate those dros/leds.

scott
Title: Re: Dialog box that enters information into custom DRO's
Post by: Tarak on May 21, 2013, 01:37:32 PM
Hi Scott,
Thanks, I'll look it up and give it a go.
Darc
Title: Re: Dialog box that enters information into custom DRO's
Post by: Tarak on May 21, 2013, 04:29:37 PM
Hi Scott, I had a go at populating a DRO, but I suppose you can guess how that went!
I tried the below code (bear in mind I am very green at the moment, so be gentle).
Can I put the entire code into the one button? So it populates the list and also checks to see which has been selected, therefore populating DRO's?
(The message lines are only so I could follow how far it's reading the code, it only displays the message 1)


Message "1"
Sub Main
Dim MyList$ (4)
MyList (0) = "Item 1"
MyList (1) = "Item 2"
MyList (2) = "Item 3"
MyList (3) = "Item 4"
MyList (4) = "Item 5"
Begin Dialog BoxSample 16,35,256,89,"Drop-Down List Box"
OKButton 204,24,40,14
CancelButton 204,44,40,14
DropListBox 124,24,72,40, MyList$( ),.DrpList
Text 124,12,68,8,"Drop-Down List Box:"
End Dialog

Message "2"
Dim Dlg1 As BoxSample
Button = Dialog ( Dlg1 )
End Sub

Message "3"
Select Case Dlg1
   Case "Item 0"
   SetUserDRO(1204,0)
   
   Case "Item 1"
   SetUserDRO(1204,1)
   
   Case "Item 2"
   SetUserDRO(1204,2)
   
   Case "Item 3"
   SetUserDRO(1204,3)
   
   Case "Item 4"
   SetUserDRO(1204,4)
   
   Case "Item 5"
   SetUserDRO(1204,5)
Case Else
End Select
Message "4"

On an unrelated note, I noticed you do training on Sure Servo Drives, are these easy/ish to interface with Mach3?
If so, I wouldn't mind doing some training, I know the basics of servos, but it would be good to learn it properly.
Title: Re: Dialog box that enters information into custom DRO's
Post by: poppabear on May 23, 2013, 06:30:59 PM
try sticking your code, into a cyclic macro, and have your buttons call into that via ULED.

Sure Servos, Yes, easy, see website for training cost/availabiltiy.
Title: Re: Dialog box that enters information into custom DRO's
Post by: Tarak on May 24, 2013, 04:49:39 PM
Thanks Scott.