Calendar Class learning curve (1 Viewer)

FuzMic

DataBase Tinker
Local time
Today, 15:50
Joined
Sep 13, 2006
Messages
719
Hi folks

Instead of using msActiveX calendar, I am starting to tinker with a calendar CLASS module template eg clsCalendar which can create instances of Calender form that has a title & close button. I want to remove the title, close button and adjust the height of the form.

A OpeningForm in Access02/03 on opening has the following codes

Private Calendar As clsCalendar

Private Sub Form_Load()
Set Calendar = New clsCalendar
Calendar.hWndForm = Me.hWnd
End Sub

There is a cmdButton on this OpeningForm which call up a Function(Calendar, dateStart, dateEnd) which will open up the Calendar.

The question is where in the Class can i tinker with the title, close button & height of the calendar.

Appreciate any form of leads.
 

FuzMic

DataBase Tinker
Local time
Today, 15:50
Joined
Sep 13, 2006
Messages
719
Hi members

Let me give you the background to the thread.

In the quest to create calender control, i imagine that they are 3 options:
1) creating a class within .mdb eg by Stephen Lebans
2) create a .ocx for a calender activex control similar mscal.ocx.
3) create a .dll using .def/linker which has a function to call up a form

Option 1 is the path that lead me to start this thread as i have difficulty understanding Leban's class codes, i would like to tweat it. Option 2 work as evidenced by mscal.ocx, but what about option 3.

Appreciate comments such as problems, viability, other alternatives.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 17:50
Joined
Jan 20, 2009
Messages
12,859
Post a link to Leban's code that you are using for your class.

The class may have Methods (public functions) which adjust the properties of its elements. If it doesn't then you could add them.

BTW This is a good intro to classes by Chip Pearson.

Writing a dll is much more complex than a creating class in Access.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 17:50
Joined
Jan 20, 2009
Messages
12,859
The height of the calendar is determined automatically from the font size setting. What exactly is your goal here?

If you just want to change the window name permanently you could change the Title and mcTitle constants. These would need to be changed in the class and modCalendar.

(Different parts were written by different people and it is not as well coordinated as it could be. Some of the constants are declared in multiple scopes where they could probably be consolidated.)

Basically to set the title dynamically you would need to use variables instead of constants. Note that the name of the window is also used to get its window handle so it needs to be coordinated with these variables too.

To get rid of the Close button add this Sub to modCalendar.

Code:
Private Sub KillX()
 
Dim lngStyle As Long
Dim hWnd As Long
 
    hWnd = FindWindow(CLASSNAME, Title)
    lngStyle = GetWindowLong(hWnd, GWL_STYLE)
    SetWindowLong hWnd, GWL_STYLE, (lngStyle And Not WS_SYSMENU)
 
End Sub

Call KillX in the ShowMonthCalendar function just before the modal logic section that starts with the comment:
"The following logic is required to ensure our MonthCalendar window"

Note the user can still close the window by the other usual means including Escape.
 

FuzMic

DataBase Tinker
Local time
Today, 15:50
Joined
Sep 13, 2006
Messages
719
Hi mate, you are a great guy, great help, great effort, etc, etc. THANK YOU.

My general goal is to use the calendar class to learn about class programming in vb6. My specific goal is to make an instance of this class without the title so that if i put the calender into my Access02/03 Apps user just see only the essentials.

Following your great pointer, to kill the form title all together, i change the KillX() using the following line: SetWindowLong hWnd, GWL_STYLE, (lngStyle And WS_BORDER)

With this i still end up with a white band at the bottom of the form. I have now to tweat the height (see the attached .jpg). Another pointer from you will make my learning zoom up faster.

Cheers to you.
 

Attachments

  • Caldr.jpg
    Caldr.jpg
    24.4 KB · Views: 151

Galaxiom

Super Moderator
Staff member
Local time
Today, 17:50
Joined
Jan 20, 2009
Messages
12,859
Look in the class for where the value of lngTempBottom is calculated and try reducing that value.
 

FuzMic

DataBase Tinker
Local time
Today, 15:50
Joined
Sep 13, 2006
Messages
719
Hi GX, The white space as shown in the .jpg comes from removing the title and the menu bar. Reducing the lngTempBottom in the apiSetWindowPos() do reduce the height of the windows BUT white bottom band remaining the same height. Still looking for the right tweat. :(
 

Users who are viewing this thread

Top Bottom