OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 22-12-2004, 20:07
Posts: n/a
Default question

I have two questions .

1.how do I get the font face list, like the one corel provides in a sorted alphabetical order currently i am getting the list like this and putting the font face in a combobox in my form.

'The FontList object contains all the font the user can use select from the listbox
' put these font face names into a list box
nCount = 1
For Each v In FontList
cboFontFace.AddItem v
'Let's find a default font to set
If v = strDefaultFont Then
'Here we have found the default font strDefaultFont
nDefaultFont = nCount
End If
nCount = nCount + 1
Next v

'Now we set the default font, if one is not found, we then
'default to the first item in the list
cboFontFace.ListIndex = nDefaultFont - 1

here how do I get it alpahbeticallty sorted.

2.Whenever I select a text shape in my corel document it should get me the x and y positon,the font used to draw it and the size of the font.
i know we can use activeseletion and get all these.but what part of the program should i wirte it.
for eg if i change any font size or face and i click APPLy button on my form it changes the fonts accordingly so I have this written in apply_click() part .
similarly what is the event which tells me that there is an activeselection and it should show me all the x and y cordinates etc. should it be in APPLY_click() ?

thanks in advance

sejal shah
Reply With Quote
Old 22-12-2004, 21:27
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: question


Unfortunately in VBA's forms there is no Sorted property on list boxes, so there is no automatic way of doing it. However you can implement your own sorting mechanism. One way of doing it, is to add the strings to a collection and then sort it, and only then add the sorted string to a combobox. Or you can insert the strings in the collection in the proper places as you go. See the example below:

Private Sub UserForm_Initialize()
    Dim col As New Collection
    Dim vFont As Variant
    Dim bFound As Boolean
    Dim i As Long
    Const strDefaultFont As String = "Arial"
    For Each vFont In FontList
        bFound = False
        For i = 1 To col.Count
            If col(i) > vFont Then
                col.Add vFont, , i
                bFound = True
                Exit For
            End If
        Next i
        If Not bFound Then col.Add vFont
    Next vFont
    For Each vFont In col
        cbFontList.AddItem vFont
        If vFont = strDefaultFont Then
            cbFontList.ListIndex = cbFontList.ListCount - 1
        End If
    Next vFont
End Sub
As far as the second question is concerned, you just need to add a handler to SelectionChange event. You can find explanation of how to do this here: http://www.oberonplace.com/forum/vie...hp?p=2350#2350
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CorelDraw 11 on Mac question Anonymous General 1 10-04-2005 11:16
CreateArtisticText question...... sejal01 CorelDRAW/Corel DESIGNER VBA 1 01-01-2005 14:01
vba question bumblebee CorelDRAW/Corel DESIGNER VBA 4 04-08-2004 15:07
Node selection question Peter Clifton CorelDRAW/Corel DESIGNER VBA 1 02-12-2003 12:00
The CommandBar to linke the VB Form question levin CorelDRAW/Corel DESIGNER VBA 1 24-08-2003 12:40

All times are GMT -5. The time now is 10:57.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com