English
Forum

Listing: Callback (Text box color) from the Using XProfan

 

Detlef
Jagolski
Hi,

have the example from the Using XProfan 10 rebuilt with the new functions of XProfan 11.

has of/ one a idea Why not Klappt?

Greeting

Detlef
CompileMarkSeparation
-Begin-----------------------------------------------------------------
-HeaderFiles---------------------------------------------------------
MESSAGES.PH
WINDOWS.PH
-Variables Declaration-----------------------------------------------
Declare Ende%, OldWndProc&, hButton%
Declare hText1%, TextBk1&, hText2%, TextBk2&, hText3%, TextBk3&
-CallBack Routine----------------------------------------------------

SubClassProc

    If SubClassMessage(%hwnd, ~WM_CTLCOLORSTATIC)

        -Fuer Text1 Farbe setzen---------------------------------------

        If &sLParam = hText1%

            ~SetBkMode(&sWParam, ~TRANSPARENT)
            ~SetTextColor(&sWParam, @RGB($FF, $00, $00)) -Rot-----------
            Return TextBk1&
            Set(WinProc,1)
            -Fuer Text2 Farbe setzen---------------------------------------

        ElseIf &sLParam = hText2%

            ~SetBkMode(&sWParam, ~TRANSPARENT)
            ~SetTextColor(&sWParam, @RGB($00, $00, $FF)) -Blau----------
            Return TextBk2&
            Set(WinProc,1)
            -Fuer Text3 Farbe setzen---------------------------------------

        ElseIf &sLParam = hText3%

            ~SetBkMode(&sWParam, ~TRANSPARENT)
            ~SetTextColor(&sWParam, @RGB($00, $FF, $00)) -Gruen---------
            Return TextBk3&
            Set(WinProc,1)

        EndIf

        Set(WinProc,0)

    EndIf

EndProc

-Main----------------------------------------------------------------
-Hintergrundfarben festlegen---------------------------------------
TextBk1& = ~CreateSolidBrush(@RGB($00, $FF, $FF)) -Cyan----------
TextBk2& = ~CreateSolidBrush(@RGB($FF, $FF, $00)) -Gelb----------
TextBk3& = ~CreateSolidBrush(@RGB($FF, $00, $FF)) -Magenta-------
-Erweitertes MessageHandling abschalten----------------------------
Set(FastMode, 1)
-Fenster oeffnen---------------------------------------------------
Window 0, 0 - 640, 480
-ProgramMainRoutine mit CallBack umleiten auf eigene---------------
Set(SubClassMode,1)
SubClass %hWnd, 1
-GUI aufbauen------------------------------------------------------
hButton% = @Create(Button, %hWnd, Ende, 10, 10, 100, 24)
-Textfelder------------------------------------------------------
hText1% = @Create(Text, %hWnd,  Farbiger Text1, 10, 50, 110, 18)
hText2% = @Create(Text, %hWnd,  Farbiger Text2, 10, 70, 110, 18)
hText3% = @Create(Text, %hWnd,  Farbiger Text3, 10, 90, 110, 18)
-Dialog-Schleife---------------------------------------------------
Clear Ende%

WhileNot Ende%

    WaitInput

    If %Key = 2

        Ende% = 1

    ElseIf @Clicked(hButton%)

        Ende% = 1

    EndIf

EndWhile

-Fuellmuster freigeben---------------------------------------------
~DeleteObject(TextBk1&)
~DeleteObject(TextBk2&)
~DeleteObject(TextBk3&)
-Urspruengliche ProgramMainRoutine wieder herstellen---------------
SubClass %HWnd, 0
-End------------------------------------------------------------------<
lass=s2>- End
 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
06/19/08  
 




Jac
de
Lad
No, I Have unfortunately no idea.
 
Profan² 2.6 bis XProfan 11.1+XPSE+XPIA+XPRR (und irgendwann XIDE)
Core2Duo E8500/T2250, 8192/1024 MB, Radeon HD4850/Radeon XPress 1250, Vista64/XP
06/19/08  
 




Sebastian
König
Detlef Jagolski
Hi,
have the example from the Using XProfan 10 rebuilt with the new functions of XProfan 11.

has of/ one a idea Why not Klappt?

Hello Detlef,

you have in the code the Set(WinProc,1) each to whom return-instructions stand - the code becomes means never access. the Set(WinProc,0) integrally end is the right idea - only becomes it there into relevanten Make, i.e. if WM_CTLCOLORSTATIC for one the three Textfields gesendet watts, neither access. correctly would one Set(WinProc,0) before each return.

so functions it then at least then, if you the window short from the visible area and directly again hineinschiebst or. The Size the Fensters änderst. this behaviour arise of my view to from the Zusammenspiel following spots:

a) windows sends WM_CTLCOLORSTATIC only then, if The Objects new drawn go mussen
b) The SubClassProc becomes in XProfan only during one WaitInputs called

an Solution for this trouble have I unfortunately not yet...

MfG

Sebastian
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
06/19/08  
 




Andreas
Miethe


with one small ploy does it already.
You must your Window to that Repaint force.
CompileMarkSeparation
 $H messages.ph
 $H windows.ph
declare Text&,IsPainted&
declare ende&
declare brush&

Proc SetColor

    Parameters Textcolor&,BackColor&,wParam&

    If Brush&

        ~DeleteObject(Brush&)

    Endif

    Brush& = ~CreateSolidBrush(BackColor&)
    ~SetBkMode(wParam&, ~TRANSPARENT)
    ~SelectObject(wParam&,Brush&)
    ~SetTextColor(wParam&,Textcolor&)
    return Brush&

Endproc

SubClassProc

    If SubClassMessage(%hWnd, ~WM_CTLCOLORSTATIC)

        Set(WinProc, 0)
        Return SetColor($FF00FF,$FFFF00,&swParam)

    elseIf SubClassMessage(%hwnd,~WM_TIMER)

        Set(WinProc, 0)

        If IsPainted& = 0

            Repaint
            ~KillTimer(%hwnd,1)
            IsPainted& = 1

        Endif

    EndIf

EndProc

cls
Set(SubClassMode,1)
SubClass %HWnd, 1
Text& = Createtext(%hwnd,Farbe,10,10,120,24)
~settimer(%hwnd,1,1,0)

whilenot ende&

    waitinput

endwhile

Subclassing wieder ausschalten
SubClass %HWnd, 0
~DeleteObject(Brush&)
 href='./../../references-fonction/XProfan/end/'>end
 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
06/20/08  
 




Sebastian
König
Andreas Miethe
with one small ploy does it already.
You must your Window to that Repaint force.
(...)


Ah, very trickreich - not so bad!
 
Windows XP, XProfan/Profan² 4.5 bis 11
Profan2Cpp-Homepage:  [...] 
Alte Profan²-Seite:  [...] 
06/20/08  
 




Detlef
Jagolski
Hello Andreas,

what should I say: thanks

have now your example on Edit extended. there have I another trouble!
CompileMarkSeparation
MESSAGES.PH
WINDOWS.PH
declare Text&,Edit&,IsPainted&
declare ende&
declare brush&

Proc SetColor

    Parameters Textcolor&,BackColor&,wParam&

    If Brush&

        ~DeleteObject(Brush&)

    Endif

    Brush& = ~CreateSolidBrush(BackColor&)
    ~SetBkMode(wParam&, ~TRANSPARENT)
    ~SelectObject(wParam&,Brush&)
    ~SetTextColor(wParam&,Textcolor&)
    return Brush&

Endproc

SubClassProc

    If SubClassMessage(%hWnd, ~WM_CTLCOLORSTATIC)

        Set(WinProc, 0)
        Return SetColor($FF00FF,$FFFF00,&swParam)

    elseIf SubClassMessage(%hwnd, ~WM_CTLCOLOREDIT)

        Set(WinProc, 0)
        Return SetColor($FF00FF,$FFFF00,&swParam)

    elseIf SubClassMessage(%hwnd,~WM_TIMER)

        Set(WinProc, 0)

        If IsPainted& = 0

            Repaint
            ~KillTimer(%hwnd,1)
            IsPainted& = 1

        Endif

    EndIf

EndProc

cls
Set(SubClassMode,1)
SubClass %HWnd, 1
Text& = Createtext(%hwnd,Farbe,10,10,120,24)
Edit& = Createedit(%hwnd,Farbe,10,60,120,24)
~settimer(%hwnd,1,1,0)

whilenot ende&

    waitinput

endwhile

Subclassing wieder ausschalten
SubClass %HWnd, 0
~DeleteObject(Brush&)
ass=s4 href='./../../references-fonction/XProfan/end/'>end

now my trouble, if I the Context menu open or if I the Edit with the mouse leave is the XP Style lane.

have You another ploy?

Greeting

Detlef
 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
06/20/08  
 




Andreas
Miethe


I fürchte is not integrally so simply go.
moreover must one itself tiefergehend with Themes keep busy.

look time here:

[...] 
 
Gruss
Andreas
________ ________ ________ ________ _
Profan 3.3 - XProfanX2
Win 95,98,ME,2000,XP,Vista - Win 7 32 / 64 Bit
ASUS X93S - Intel Core I7-NVIDIA GForce 540M 8GB Arbeitsspeicher
Homepage :  [...] 
06/20/08  
 




Detlef
Jagolski
Hello Andreas,

many Thanks.

Greeting

Detlef
 
XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11
06/20/08  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.221 Views

Untitledvor 0 min.
H.Brill02/05/22
rafl09/17/17
Ernst03/02/15
Detlef Jagolski04/06/14
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie