PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Richard Kelly on April 19, 2014, 12:49:02 AM

Title: RRButton Font Upgrade
Post by: Richard Kelly on April 19, 2014, 12:49:02 AM
Can you add a "FontUpgrade" property to the control that FF will recognize and how would you do that?

Rick Kelly
Title: Re: RRButton Font Upgrade
Post by: David Kenny on April 19, 2014, 04:55:47 AM
Richard,

Could you explain what a Font Upgrade is? 
Title: Re: RRButton Font Upgrade
Post by: Richard Kelly on April 19, 2014, 05:05:39 AM
Quote from: David Kenny on April 19, 2014, 04:55:47 AM
Richard,

Could you explain what a Font Upgrade is?

FF has a property on the common controls that will change the provided font to Segoe UI when the OS version is Vista or later.

Rick
Title: Re: RRButton Font Upgrade
Post by: David Kenny on April 19, 2014, 05:52:08 AM
Thanks Richard!
Title: Re: RRButton Font Upgrade
Post by: Richard Kelly on April 23, 2014, 02:31:34 AM
If I add:


[Property]
name        = fontupgrade|FontUpgrade
curvalue    = 1 - True
itemtype    = Combo
cmbitems    = 0 - False|1 - True
equates     = 0|1


to the RRButton.ctl file, will FF recognize it?

Rick
Title: Re: RRButton Font Upgrade
Post by: Richard Kelly on April 25, 2014, 06:02:12 AM
I answered my own question and the answer is no. FF does not recognize the addition of the fontupgrade property. I checked the generated code and the call to FLY_SetControlData are exactly the same with fontupgrade always set to %FALSE.

Have to look for another way.

Rick
Title: Re: RRButton Font Upgrade
Post by: Richard Kelly on April 28, 2014, 12:13:01 AM
I decided to minimize the use of RRButton for now. I can either manually edit the source for the final compile or put code in to replace the font after FF has created it. I'll decide later.

I switched over to a top menu bar with hover detection as the attachment shows.

I studied both RRButton and the FFTextLines controls and "borrowed" their strategy.


Sub HoverText (ByVal hWndControl As Dword, wMsg As Dword)

Local hTimer        As Dword

    Select Case wMsg
   
        Case %WM_MOUSEMOVE
       
            If CT_CursorPtInRegion (hWndControl) Then
               
                hTimer = Val(FF_Control_GetTag (hWndControl))
                If hTimer = 0 Then
               
                   hTimer = SetTimer (hWndControl, hTimer, 10, 0)
                   FF_Control_SetTag (hWndControl, Format$(hTimer))
                   FF_Control_SetColor (hWndControl, Rgb(235,107,70), -1)
               
                End If
   
            End If
           
        Case %WM_TIMER

            If CT_CursorPtInRegion (hWndControl) = 0 Then
               
                hTimer = Val(FF_Control_GetTag (hWndControl))
                If hTimer <> 0 Then
               
                   KillTimer (hWndControl, hTimer)
                   FF_Control_SetTag (hWndControl, "")
                   
                   FF_Control_SetColor (hWndControl, Rgb(216,216,216), -1)
               
                End If
               
            End If   
   
    End Select

End Sub
Function CT_CursorPtInRegion (ByVal hWnd As Dword) As Long
  Local rc As Rect
  Local pt As PointApi

  GetWindowRect hWnd, rc   
  GetCursorPos pt         
  Function = PtInRect(rc, pt)

End Function


I just call the routine in the CUSTOM handler for each text label control, and of course, I have it set for my colors.

Rick
Title: Re: RRButton Font Upgrade
Post by: David Kenny on April 28, 2014, 05:17:25 AM
Rick,

Until now I thought I was the only person to modify FF codegen files to add or modify functionality.  I've suggested it several times in the past to people looking for solutions to their problems but usually I just get crickets.  Although it's not ideal, it gets the job done and usually that's the most important thing to me.  Whether it's to implement a workaround for a FF code generation bug (Paul is usually plenty fast to fix those), or simply to modify some other aspect of FF operation itself, it seems that most people don't want to delve into the inner workings of FF.  I have personally learned a great deal from analyzing how FF operates and how Paul implements things.

QuoteI studied both RRButton and the FFTextLines controls and "borrowed" their strategy.
Another good strategy.  They are just code.  You can take them apart and rewrite them with only the features you need, and modify them to work the way you want or to add new features.   
Title: Re: RRButton Font Upgrade
Post by: Paul Squires on April 28, 2014, 10:56:08 AM
Hi Guys,

Sorry, yeah I haven't been around much lately. March/April are the busiest months of the year for me at my job so I don't do much programming at all then (as you can see from the lack of posts in the C++ forum as well).

In the absence of a FontUpgrade property for external controls, you could create modify the RRButton.inc file directly and add code to detect the operating system and change the font face?
Title: Re: RRButton Font Upgrade
Post by: Richard Kelly on April 28, 2014, 11:56:37 PM
I did look at updating RRButton for the font upgrade in the WM_SetFont message. Whether I do that or change the font in the FF control data area it means having font handles generated twice. While that is not likely a big deal, I chose to defer for now whether to do one of those two approaches or just updating the CODEGEN files and change all the %FALSE flags to %TRUE at the final release compile.

I'll admit I was just a wee bit hopeful that FF might get a small maintenance release where quick things like this might be addressed.

Rick
Title: Re: RRButton Font Upgrade
Post by: Paul Squires on April 29, 2014, 10:14:14 PM
Quote from: Richard Kelly on April 28, 2014, 11:56:37 PM
I'll admit I was just a wee bit hopeful that FF might get a small maintenance release where quick things like this might be addressed.

Hi Rick, I agree with you. What I will do is post EXE updates for minor changes and upload the EXE as an attachment to a forum post. This will make it a lot easier (and faster) to get small updates out rather than waiting until 10 or 20 fixes are available.