functions FF_ for MonthCalendar

Started by Pedro Marquez, January 19, 2015, 11:23:22 AM

Previous topic - Next topic

Pedro Marquez

Where the functions FF_ for the object MonthCalendar

set y get


David Kenny

Hello Pedro,

FF uses Jose's includes.  Hopefully you have downloaded Jose's help files (specifically WinApiHeaders.chm) where you will find documentation under:
Contents - Windows Controls Wrapper Functions - Month Calendar Control

Or, on the index tab after typing in Monthcal.

If you haven't downloaded the help file, you can locate the MonthCalCtrl.inc file in the includes themselves and inspect it in your favorite editor.

David

Pedro Marquez

Looking for a demo on calendar in FF

David Kenny

What do you need the demo to do?  I might be able to whip one up.

David Kenny

I realized I should point out that the FF_ function were just wrappers that Paul graciously included in FF for most of the more commonly used control.  He also has provided a way to add any of your favorite routines, wrappers etc. to FF as well.

Paul, is there a way that Jose's wrappers could be included in the Functions library without including the code?  In other words, just the call itself. So that Pedro, for instance, could add a function call  without duplicating the code in the wrapper (which is already available to the compiler through Jose's .inc file).  Of course he could also add the code, but would have to modify the names of the functions to not get a duplicate function name error.

Just to give you something to pick that inserts the correctly spelled function into FF along with the "reminder" argument list.

Paul Squires

Hi David, yes I have often thought that somehow having Jose's wrapper references in the FF library would make them more widely used. I think that all you'd need to do is tick the checkbox called "Prototype only" found on the "Details" tab for the function you wish to use. There are hundreds of functions that Jose has created. Adding all of them to the FF library is a lot of work. :)
Paul Squires
PlanetSquires Software

David Kenny

Paul,

Thanks for the "Prototype only" tip. That looks like what I was asking about.

I agree that it would be quite a task, but I was thinking that doing control by control as you investigate new controls might be the way to go.  The first thing you need to familiarize yourself with a new control is to get to know the the routines used to interact with it. A good first step (for me anyway) is to read the list of functions and messages it uses all the way through (even though you might only use a few of them most of the time).  And it makes sense to me that creating the entries in the Function Library might be a good way to accomplish that.

Another way would be to get volunteers to donate their time to creating a  small list of them.  There would need to be some sort of standards manual, so that they didn't all look too different from each other.  Heck, might even be able to run a program against the includes to automate most of the work.  I've been pretty happy with my experience using regular expressions in PB.  It really makes things like that very easy to do.

Pedro Marquez

Solo necesito la funcion para saber la fecha pulsada desde el calendario y aqui tengo algo, esta en español podeis pasarlo a vuestro idioma.

Devulve dia/mes/año en enteros para trabajar en el programa principal.



FUNCTION GetCalendar (BYVAL hWndControl AS DWORD, sDay AS INTEGER,_
SMonth AS INTEGER,sYear AS INTEGER) AS LONG

    LOCAL Dia,Mes,Result AS STRING
    DIM DT AS SYSTEMTIME
    MonthCal_GetCurSel( HWND_FORM1_MONTHCALENDAR1 , DT)

    SELECT CASE DT.wDayOfWeek
    CASE 1 : Dia="Lunes"
    CASE 2 : Dia="Martes"
    CASE 3 : Dia="Miercoles"
    CASE 4 : Dia="Jueves"
    CASE 5 : Dia="Viernes"
    CASE 6 : Dia="Sabado"
    CASE 0 : Dia="Domingo"
    END SELECT

    SELECT CASE DT.wMonth
    CASE 1 : Mes="Enero"
    CASE 2 : Mes="Febrero"
    CASE 3 : Mes="Marzo"
    CASE 4 : Mes="Abril"
    CASE 5 : Mes="Mayo"
    CASE 6 : Mes="Junio"
    CASE 7 : Mes="Julio"
    CASE 8 : Mes="Agosto"
    CASE 9 : Mes="Septiembre"
    CASE 10 : Mes="Obtubre"
    CASE 11 : Mes="Noviembre"
    CASE 12 : Mes="Diciembre"
    END SELECT

    SetWindowText hWndControl, Dia & " " & TRIM$(STR$(DT.wDay)) & " " +_
    Mes & " " + TRIM$(STR$(DT.wYear))

    sDay = DT.wDay
    sMonth = DT.wMonth
    sYear = DT.wYear

END FUNCTION







Incluye una demo y GetCalendar.inc para meter en CodeStore


David Kenny

Good work Pedro.

It is a shame that you can't tell the control what language to display (Month and Days and Today).

Pedro Marquez

#9
This function looks in the registry

? FF_GetRegistryString (%HKEY_LOCAL_MACHINE,"SYSTEM\CurrentControlSet\Control\Nls\Language","Default","0")

Spanish language code = 0C0A hexa

or

? STR$(GetSystemDefaultLangID)
Spanish language code = 3082 decimal

David Kenny

Pedro,

You taught me something today!  I switched the language on my machine to Spanish and looked at your demo program again.  Very nice. :D

It makes sense that it would work that way, I just never had a reason to think about it.

David