WinFBE Suite 1.7.5 (August 22, 2018)

Started by Paul Squires, August 22, 2018, 04:52:19 PM

Previous topic - Next topic

Wilko Verweij

Hi Ray,
You can use labels/statics as well as buttons to display images. But they behave differently.

raymw

Hi Wilko,
I've not got around to testing that advanced stuff. I'm getting problems just clicking on 'em.
Best wishes,

Ray

Paul Squires

Hi Ray, thanks for testing the Label double clicking GPF. I looked further into it and it looks like was not handling the STN_DBLCLK message for the label (and then needing to dispatch it to the MouseDoubleClick handler). I made the change and it appears now that the Labels are working okay in the test code that you posted. I need to now look at the Button coloring you have spoken about.
Paul Squires
PlanetSquires Software

José Roca

Quote from: rainheart311 on August 24, 2018, 11:39:05 PM
After version 1.7.3, there is such a problem: strange characters appear at the end of the Chinese menu and prompts, such as: 工具 (T) M, where M is redundant. Looking for the source code, it should be a problem with Mid, because it uses CWStr, so you need to use CWStr's MidChars function, I made such a modification, the display is normal:
     'wData = Mid(wst, i+1)
     wData = wst.MidChars(i+1)
In addition, thank you for your efforts and look forward to new progress.

I have made a test with "工具".


DIM cws AS CWSTR = "工具"
AfxMsg MID(cws, 2)
AfxMsg MID(cws.wstr, 2)
AfxMsg MID(**cws, 2)
AfxMsg cws.MidChars(2)


Although the four variations return the same WSTRING pointer, MID(cws, 2) fails and the other three work. Why? I don't know. Maybe MID(cws, 2) if failing to recognize the returned pointer as a WSTRING pointer and interprets it as a ZSTRING pointer?

With LEFT and RIGHT, I solved the problem overloading them:


' ========================================================================================
PRIVATE FUNCTION Left OVERLOAD (BYREF cws AS CWSTR, BYVAL nChars AS INTEGER) AS CWSTR
   RETURN LEFT(*cast(WSTRING PTR, cws.m_pBuffer), nChars)
END FUNCTION
' ========================================================================================
' ========================================================================================
PRIVATE FUNCTION Right OVERLOAD (BYREF cws AS CWSTR, BYVAL nChars AS INTEGER) AS CWSTR
   RETURN RIGHT(*cast(WSTRING PTR, cws.m_pBuffer), nChars)
END FUNCTION
' ========================================================================================


But MID can't be overloaded, so we must use **.

Paul Squires

Thanks for the info. I will update all mid code to use**
Paul Squires
PlanetSquires Software

Paul Squires

Jose, here is an interesting side effect I've discovered when I changed MID to use **. If MID returns a null string "" then it does not clear the CWSTR. If I do not use ** then it does clear. Here is test code that shows the problem:


#include once "Afx\CWSTR.inc"

dim as long i
dim as CWSTR wszMain, wszTemp

wszMain = "This is the main string="
wszTemp = "This is the temp string"

i = instr(wszMain, "=")

if i then
   wszTemp = mid(**wszMain, i + 1)
   'wszTemp = mid(wszMain, i + 1)   ' <-- this works correctly
end if

? "i = "; i
? "wszTemp = "; wszTemp
?
? "wszTemp should be zero length, but it keeps the value 'This is the temp string'"

sleep


Paul Squires
PlanetSquires Software

José Roca

Easy to fix. I have moved the ckeck for a null pointer after the call to this.clear.


' ========================================================================================
PRIVATE OPERATOR CWstr.Let (BYREF pwszStr AS WSTRING PTR)
   CWSTR_DP("CWSTR LET WSTRING PTR = " & .WSTR(pwszStr))
   this.Clear
   IF pwszStr = NULL THEN EXIT OPERATOR
   this.Add(*pwszStr)
END OPERATOR
' ========================================================================================


Paul Squires

Excellent, thanks José - works perfectly.
Paul Squires
PlanetSquires Software

raymw

Hi Paul
Quote
Hi Ray, thanks for testing the Label double clicking GPF.
thanks for your thanks.
When you have the chance, have a look at the difference between the button and label text alignment. The label text behaves better, word wrapping nicely to multi lines for top line, maybe the centre line should word wrap both up and down lines, but the button text, even though there are more line choices, does no word wrapping (unless there's a preset I've not found).

Paul Squires

Hi José,

There is currently no SetButtonBkColorHot setting so I noticed that when you paint the button that you use hBkBrushDown as the hot brush. This is what has led to Ray's observation earlier in this thread that the button back color is not colored correctly on MouseUp in his sample program.

I can see 2 options:

(1) Implement a Hot color for the button (I can easily add this within the WinFBE property list as well), or:

(2) Change the code around Line 959 to change the logic to use the hBkBrush instead of hBkBrushDown:

From:
         DIM rc2 AS RECT = rcContent
         .InflateRect @rc2, -1, -1   ' // To no overwrite the border
         If iStateId = PBS_HOT And m_hBkBrushDown <> Null Then
            .FillRect hDc, @rc2, m_hBkBrushDown
         ELSE
            IF m_hBkBrush THEN .FillRect hDc, @rc2, m_hBkBrush
         END IF

To:
         DIM rc2 AS RECT = rcContent
         .InflateRect @rc2, -1, -1   ' // To no overwrite the border
         IF m_hBkBrush THEN .FillRect hDc, @rc2, m_hBkBrush


If you chose to implement a Hot setting then the code could be like:

         DIM rc2 AS RECT = rcContent
         .InflateRect @rc2, -1, -1   ' // To no overwrite the border
         IF m_hBkBrush THEN .FillRect hDc, @rc2, m_hBkBrush   ' the default
         If iStateId = PBS_HOT AndAlso m_hBkBrushHot <> Null Then
               .FillRect hDc, @rc2, m_hBkBrushHot
         END IF

What are your thoughts on this?
Paul Squires
PlanetSquires Software

José Roca

If you alreeady have tried it, give me your CxpButton.inc to incorporate it to the framework. If not, tell me which one of the two options you prefer. Personally, I don't care, since I'm not going to use colored buttons.

Paul Squires

Quote from: José Roca on August 26, 2018, 03:48:00 PM
If you alreeady have tried it, give me your CxpButton.inc to incorporate it to the framework. If not, tell me which one of the two options you prefer. Personally, I don't care, since I'm not going to use colored buttons.

Ok, I am working the additions now and will post the modified file as soon as I am done.  :)
Paul Squires
PlanetSquires Software

Paul Squires

Okay, the attached has the additions for the "Hot" brush color when mouse is over the button control.
Paul Squires
PlanetSquires Software

José Roca

Thanks. And if you want to add half a dozen colors more, feel free to do it :)

José Roca

BTW see how easy is to make changes using soure code. If we were using libraries, we would have to build new libraries for both 32 and 64-bit, generate an import library, instruct people where to place them... Crazy!