Visual Basic Customization

Reply
*Elmore, Andrew
Message 1 of 9 (58 Views)

Layer color promt?

58 Views, 8 Replies
07-03-2003 03:52 AM
How can I call the layer color promt and capture the users selection trough
vb/vba. If I use windows color object then the knowncolors do not match
acad's.

Andy
*Menzi, Jürg
Message 2 of 9 (58 Views)

Re: Layer color promt?

07-03-2003 04:37 AM in reply to: *Elmore, Andrew
Andrew Elmore

courtesy of Randall Rath:

calling sub:
Dim lColor As Long
lColor = ChooseColor(lColor, True, lColor)

'Color choice using autocad color selection dialog box
'
Public Function ChooseColor(ByVal lngInitClr As Long, _
ByVal blnMetaColor As Boolean, _
ByVal lngCurClr As Long) As Long
ChooseColor = -1

On Error Resume Next

If acedSetColorDialog(lngInitClr, blnMetaColor, lngCurClr) Then
ChooseColor = lngInitClr
End If

On Error GoTo 0

End Function

Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch
*Elmore, Andrew
Message 3 of 9 (58 Views)

Re:

07-03-2003 06:15 AM in reply to: *Elmore, Andrew
Thanks for the reply buy what do I dim "acedSetColorDialog" to. It's looking
for a function but I still can not get the color promt.

Thanks,
Andy
"Jürg Menzi" wrote in message
news:3F048616.F9D4FF50@bluewin.ch...
> Andrew Elmore
>
> courtesy of Randall Rath:
>
> calling sub:
> Dim lColor As Long
> lColor = ChooseColor(lColor, True, lColor)
>
> 'Color choice using autocad color selection dialog box
> '
> Public Function ChooseColor(ByVal lngInitClr As Long, _
> ByVal blnMetaColor As Boolean, _
> ByVal lngCurClr As Long) As Long
> ChooseColor = -1
>
> On Error Resume Next
>
> If acedSetColorDialog(lngInitClr, blnMetaColor, lngCurClr) Then
> ChooseColor = lngInitClr
> End If
>
> On Error GoTo 0
>
> End Function
>
> Cheers
> --
> Juerg Menzi
> MENZI ENGINEERING GmbH, Switzerland
> http://www.menziengineering.ch
*Propst, Mark
Message 4 of 9 (58 Views)

Re:

07-03-2003 12:41 PM in reply to: *Elmore, Andrew
Maybe check randall's site - maybe the function is there, or there's some
reference needing set. I couldn't find it in the help either.

"Andrew Elmore" wrote in message
news:11974486DB472FF46FFBF4BA841F0F06@in.WebX.maYIadrTaRb...
>
> Thanks for the reply buy what do I dim "acedSetColorDialog" to. It's
looking
> for a function but I still can not get the color promt.
>
*Menzi, Jürg
Message 5 of 9 (58 Views)

Re:

07-03-2003 05:11 PM in reply to: *Elmore, Andrew
Andrew

Ok, ok I shut too fast... you need to declare the AutoCAD API:

Public Declare Function acedSetColorDialog Lib "acad.exe" ( _
ByRef intColor As Long, _
ByRef fAllowMetaColors As Boolean, _
ByRef intNewColor As Long) As Boolean

Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch
*Elmore, Andy
Message 6 of 9 (58 Views)

Re:

07-05-2003 03:52 AM in reply to: *Elmore, Andrew
Okay i must be an idot because i still can not get this work.

Thanks,

Andy
"Jürg Menzi" wrote in message
news:3F05369B.1FBD816F@bluewin.ch...
> Andrew
>
> Ok, ok I shut too fast... you need to declare the AutoCAD API:
>
> Public Declare Function acedSetColorDialog Lib "acad.exe" ( _
> ByRef intColor As Long, _
> ByRef fAllowMetaColors As Boolean, _
> ByRef intNewColor As Long) As Boolean
>
> Cheers
> --
> Juerg Menzi
> MENZI ENGINEERING GmbH, Switzerland
> http://www.menziengineering.ch
*Menzi, Jürg
Message 7 of 9 (58 Views)

Re:

07-06-2003 03:39 PM in reply to: *Elmore, Andrew
Andy

This is my implementation of Randall's color dialog sample:

Private Declare Function acedSetColorDialog Lib "acad.exe" (Color As Long, _
ByVal bAllowMetaColor As Boolean, ByVal nCurLayerColor As Long) As Boolean

Public Function MeGetAcadColor(DefCol As Long, MtaCol As Boolean, _
LayCol As Long) As Long

MeGetAcadColor = -1

On Error Resume Next

If acedSetColorDialog(DefCol, MtaCol, LayCol) Then
MeGetAcadColor = DefCol
End If

End Function

Works with A2k, A2ki and A2k2...

Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch
*Elmore, Andrew
Message 8 of 9 (58 Views)

Re:

07-14-2003 10:11 PM in reply to: *Elmore, Andrew
I figured out my problem. I needed to change the declare to Private not
public.

Andy

"Jürg Menzi" wrote in message
news:3F091585.77DC76E7@bluewin.ch...
> Andy
>
> This is my implementation of Randall's color dialog sample:
>
> Private Declare Function acedSetColorDialog Lib "acad.exe" (Color As Long,
_
> ByVal bAllowMetaColor As Boolean, ByVal nCurLayerColor As Long) As Boolean
>
> Public Function MeGetAcadColor(DefCol As Long, MtaCol As Boolean, _
> LayCol As Long) As Long
>
> MeGetAcadColor = -1
>
> On Error Resume Next
>
> If acedSetColorDialog(DefCol, MtaCol, LayCol) Then
> MeGetAcadColor = DefCol
> End If
>
> End Function
>
> Works with A2k, A2ki and A2k2...
>
> Cheers
> --
> Juerg Menzi
> MENZI ENGINEERING GmbH, Switzerland
> http://www.menziengineering.ch
*Menzi, Jürg
Message 9 of 9 (58 Views)

Re:

07-15-2003 09:41 PM in reply to: *Elmore, Andrew
...:-)

Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community