English
Forum

Iconbutton with text - Icon only Interpreter

 

E.T.
Hello XProfan-Gemeinde,
I use gladly The Icon-Buttons with text,



How in the code under displayed. yet I had so no Problems, I The Icon's a Dll loaded Have. with one little Mini-proposition, which without Dll get along ought to, is me now the following noticed:
in the Interpreter functions the integrally wonderful, starte I but the finished Exe, is the Icon on the Button only sporadisch, mostly only at first Program Start, To see.

someone 'ne idea ???
happens incidentally in the example here: [...]  too. Getestet with XProfan 11/12/X2
CompileMarkSeparation
SubProc Create.BigPicButton

    Parameters Ziel&, Text$, PosX%, PosY%, Breite%, Hoehe%, Icon&
    var BigPicButton& = @control("Button",Text$,$50012200+$2000000,PosX%,PosY%,Breite%,Hoehe%,Ziel&,1000,%Hinstance)
    Button_Refresh BigPicButton&, Icon&
    Return BigPicButton&

EndProc

Proc Button_Refresh

    Parameters Button&, Icon&
    var Refresh_Button&=@control("Static","",$50000003,12,12,32,32,Button&,0,%Hinstance)
    @Sendmessage(Refresh_Button&,$170,Icon& ,0)

EndProc

Declare BtnIcon&, Button&
BtnIcon& = @Create("hIcon","Baum")
CLS
Button& = @Create("BigPicButton",%HWnd,"Test- \nButton ",20,20,150,60,BtnIcon&)
waitinput
DeleteObject BtnIcon&
end

7 kB
Hochgeladen:05/08/11
Downloadcounter182
Download
 
Grüße aus Sachsen... Mario
WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte...
05/08/11  
 




Dieter
Zornow
look you time whom code on the goes, is too comments Why. with you missing what.
CompileMarkSeparation
'Autor Dieter Zornow
DEF LoadImage(6) !"USER32","LoadImageA"
Def DestroyIcon(1) ! "User32","DestroyIcon"
Declare icon&[]
Var himh& = 0

proc destroyobject

    whileloop 0,sizeof(icon&[])-1

        DestroyIcon(icon&[&loop])

    endwhile

endproc

proc showbutton'damit das Icon auch immer wieder angezeigt wird, ohne diese Proc wird es in der Exe nicht mehr angezeigt

    parameters hdl&' handle des Static controls
    showwindow(hdl&,0)
    showwindow(hdl&,1)

endproc

'Parameter: Fenster, oder Dialoghandle, Buttontext, handle der iconresource, Iconname, x%,y%,w%,h%, ButtonID, Text Links, rechts oder Zentiert

subproc Create.ITextbutton

    Parameters hwnd&,text$,source&,image$,x%,y%,w%,h%,id&,dct$
    declare button&,st&,hpos&,hwid&
    Icon&[himh&] = LoadImage(source&,addr(Image$),$1,20,20,$0)'Icongröße = 20 x 20

    if dct$ = upper$("R")

        button& = Control("BUTTON",text$,$54010200,x%,y%,w%,h%,hwnd&,id&,%hinstance,$0100)

    elseif dct$ = upper$("L")

        button& = Control("BUTTON",text$,$54010100,x%,y%,w%,h%,hwnd&,id&,%hinstance,$0100)

    elseif dct$ = upper$("C")

        button& = Control("BUTTON",text$,$54010000,x%,y%,w%,h%,hwnd&,id&,%hinstance,$0100)

    endif

    hpos& = height(button&) - 20
    hpos& = int(hpos&/2)
    hwid& = width(button&) -23' 3 pixel vom Rand weg + Icongröße

    if (dct$ = upper$("R")) or (dct$ = upper$("C"))

        st& = control("Static","",$50000003,3,hpos&,20,20,button&,0,%Hinstance)

    else

        st& = control("Static","",$50000003,hwid&,hpos&,25,20,button&,0,%Hinstance)

    endif

    Sendmessage(st&,$170,Icon&[himh&],0)
    inc himh&
    showbutton(st&)
    return str$(button&) + "|" + str$(st&)

endproc

'Beispiel
cls
declare ende%,but$,but1&,static1&, but2&,static2&,but3&,static3&
ende% = 0
but$ =  create("ITextbutton",%hwnd,"Test  ",%hinstance,"A", 10,25,70,25,10,"R")
but1& = val(substr$(but$,1,"|"))
static1& = val(substr$(but$,2,"|"))
but$ =  create("ITextbutton",%hwnd," Test",%hinstance,"Sand", 10,60,60,25,11,"L")
but2& = val(substr$(but$,1,"|"))
static2& = val(substr$(but$,2,"|"))
but$ =  create("ITextbutton",%hwnd,"Test",%hinstance,"Wasser", 10,90,80,25,12,"C")'zentriert müssen die Buttons größer werden
but3& = val(substr$(but$,1,"|"))
static3& = val(substr$(but$,2,"|"))
usermessages 16

whilenot ende%

    waitinput
    case %UMessage = 16:ende% = 1

    if clicked(but1&)

        Messagebox("Hier1","",0)
        showbutton(static1&)'nach jeder Aktion aufrufen sonst verschwindet das Icon

    elseif clicked(but2&)

        Messagebox("Hier2","",0)
        showbutton(static2&)

    elseif clicked(but3&)

        Messagebox("Hier3","",0)
        showbutton(static3&)

    endif

endwhile

destroyobject2>()
end
 
Er ist ein Mann wie ein Baum. Sie nennen ihn Bonsai., Win 7 32 bit und Win 7 64 bit, mit XProfan X2
05/08/11  
 




Jörg
Sellmeyer
well - there would I but say, this is clear one bow and ought to not such Workarounds bedürfen...
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
05/08/11  
 




Andreas
Miethe


Jörg Sellmeyer (08.05.11)

well - there would I but say, this is clear one bow and ought to not such Workarounds bedürfen...


the stops I do not for a bow.
who one Control in one Control created, not for vorgesehen is,
the must itself really not wonder, if one WM_PAINT there not ankommt.
alike, whether the Icon a Dll or from the Exe comes, is fehlschlagen.

remedy creates, Autopaint during the Erzeugung on NULL, and thereafter again on
standard To settle, or whom Button so To valet How it it expects, with a
Bitmap,Icon or Text.
 
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 :  [...] 
05/14/11  
 



see I just as. the Program is for the Repaint its Controls zuständig. windows says only message, when very the come off ought to. This will in the code but weder quizzed, yet hereon reacted.
 
05/14/11  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.951 Views

Untitledvor 0 min.
Detlef Jagolski07/23/23
Normann Strübli02/06/23
Sven Bader08/17/21
Georg01/14/21
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