English
Includes

Buttons.inc - Very simply and free from problems with Buttons work

 

Peter
Mallow
works with Buttons was for me always stressful. If I one Button with Create(Button... prepares have, having the Buttons not so behaviour, How I it wished or. neither as in windows normally is. The alternative with Control(Button... isn't badly, only known I sometime not any more, which MenuItem now To whom Button heard.

around the everything extreme To vereinfachen and around the Overview produce, have I these INC-File written. i know The Solution isn't The eleganteste, however The simplest and particularly for ältere Profanversion 8- a Perhaps valuable expansion, there it first ex Profan 9 whom commands Clicked() given.
but too this commands has for me detriments. z.B. functions this only, if before one WaitIput erfolgte.
CompileMarkSeparation
################################################################
#                 BUTTONS.INC   Version 1.2                    #
#==============================================================#
#     Erleichtert extrem die Buttonverwaltung im Programm      #
#                                                              #
#  C o p y r i g h t  2 0 0 5   b y   P e t e r   M a l l o w  #
################################################################
Def @LoadImage(6) !"USER32","LoadImageA"
Def @ALoadImage(6) ! "USER32","LoadImageA"
Def @ExtractIcon(3) ! "SHELL32","ExtractIconA"
Declare ButtonID%,MerkeButton%[100]   MerkeButton%[100] Merkt sich das Buttonhandle, Max 100 Buttons (standart)

Proc Button

    Parameters Handle%,ButtonText$,X1%,Y1%,X2%,Y2%
    Button wird erstellt. Diese Procedure hat die gleichen
    Parameter wie CreateButton.
    Inc ButtonID%
    MerkeButton%[ButtonID%] = @Control("Button",ButtonText$,$40000000+$10000000,X1%,Y1%,X2%,Y2%,Handle%,ButtonID%+4000,%HINSTANCE)
    Return ButtonID%

EndProc

Proc CheckButton

    Parameters Button%
    Diese Funktion gibt True zurück, wenn der Button% geklickt
    wurde. PRAKTISCH ist, dass nach der Ausführung dieser Procedure
    der MenuItem-Status wieder auf 0 gesetzt wird.

    If Button%=0

        Return 0

    ElseIf @Abs(%MenuItem)=Button%+4000

        SetMenuItem 0
        Return 1

    Else

        Return 0

    EndIf

EndProc

Proc GetButtonHandle

    Parameters Button%
    Diese Funktion liefert den echten Handle vom Button zurück.
    Damit kann dann jede beliebige Funktion wie "DestroyWindow"
    normal angesteuert werden:
    Bsp. -> DestroyWindow(GetButtonHandle(Button%))
    Return MerkeButton%[Button%]

EndProc

Proc DestroyButton

    Parameters Button%
    Die Buttons, die mit der Procedure "Button" erstellt werden,
    die können nur mit dieser Funktion zerstrört werden oder Sie
    verwenden:  -> DestroyButton(MerkeButton%[ButtonHandel%]) <-
    DestroyWindow(MerkeButton%[Button%])

EndProc

Proc EnableButton

    Parameters Button%, Type%
    Die Buttons, die mit der Procedure "Button" erstellt werden,
    die können nur mit dieser Funktion zerstrört werden oder Sie
    verwenden:  -> EnableWindow MerkeButton%[ButtonHandel%],0 <-
    EnableWindow MerkeButton%[Button%],Type%

EndProc

Proc SetButtonText

    Parameters Button%, String$
    Die Buttons, die mit der Procedure "Button" erstellt werden,
    die können nur mit dieser Funktion zerstrört werden oder Sie
    verwenden:  -> EnableWindow MerkeButton%[ButtonHandel%],0 <-
    SetText MerkeButton%[Button%]ng$

ENDPROC


These Include can naturally circa BmpButton(), AniButton or IconButton(), ... discretionary strain.

if I brill ought to, and one this too plenty plainer release can, then Please Answer
too over Proposals, extensions, review and Improvements freue I

MfG
Peter Mallow
 
WinXP Pro SP2, XProfan 9 + XPSE
AMD Athlon 64 X2 3800
09/06/05  
 



now - a blemish see I on attempt - You using Integer instead of Longs. it'll of course zumeinst nevertheless functions - however gives The function Control  nunmal a Long instead of a Integer back.

salvo, iF.
 
09/06/05  
 




Peter
Mallow
OK I will make.

Sry! Diesen Thread there already :/ I dope have forget, that it it already given. means Please one the both Threads delete!!!

Sorry, wished not spammen
 
WinXP Pro SP2, XProfan 9 + XPSE
AMD Athlon 64 X2 3800
09/07/05  
 




Peter
Mallow
here The Version 2.0 from the Buttons.inc
CompileMarkSeparation
################################################################
#                BUTTONS.INC   Version 2.0                     #
#==============================================================#
#     Erleichtert extrem die Buttonverwaltung im Programm      #
#                                                              #
#  C o p y r i g h t  2 0 0 5   b y   P e t e r   M a l l o w  #
################################################################
Def @LoadImage(6) !"USER32","LoadImageA"
Def @ALoadImage(6) !"USER32","LoadImageA"
Def @ExtractIcon(3) !"SHELL32","ExtractIconA"
Def @GetDlgCtrlID(1) !"USER32","GetDlgCtrlID" Par: Handle;  Return %MenuItem
Declare ButtonID%,bmp#
ButtonID% = 4000 Startwert

Proc CheckButton

    Parameters b&
    Diese Funktion gibt True zurück, wenn der Button% geklickt
    wurde. PRAKTISCH ist, dass nach der Ausführung dieser Procedure
    der MenuItem-Status wieder auf 0 gesetzt wird.

    If (@Abs(%MenuItem) = @GetDlgCtrlID(b&)) And (b& > 0)

        SetMenuItem 0
        Return 1

    Else

        Return 0

    EndIf

EndProc

Proc CButton ein Button als Checkbox

    Parameters Wnd&,t$,X%,Y%,SizeX%,SizeY%
    Inc ButtonID%
    Return @Control("Button",t$,$50001000+3,X%,Y%,SizeX%,SizeY%,Wnd&,ButtonID%,%Hinstance)

EndProc

----------------------------------------------------------------------
- Folgende Funktionen und Prozeduren sind nur noch zu Kompatibilität -
- zur alten Version von der Button.inc vorhanden. --------------------
----------------------------------------------------------------------

Proc Button

    Parameters Wnd&,t$,X1%,Y1%,X2%,Y2%
    Inc ButtonID%
    Return @Control("Button",t$,$50000000,X1%,Y1%,X2%,Y2%,Wnd&,ButtonID%,%HInstance)

EndProc

Proc GetButtonHandle

    Parameters Button&
    Return Button&

EndProc

Proc DestroyButton

    Parameters Button&
    @DestroyWindow(Button&)

EndProc

Proc EnableButton

    Parameters Button&,t%
    EnableWindow @Button&,t%

EndProc

Proc SetButtonText

    Parameters Button&,t$
    SetText Button
ENDPROC

I have a short while ago The API GetDlgCtrlID discover. there plenty me same Improvements for Button.inc one. The large benefit this Version is, that Button() now the real lever returns. therefore go The Funtionen GetButtonHandle(), DestroyButton(), EnableButton() and SetButtonText() not any more needed, have tappt im dunkeln but yet because of compatibility in the Button.inc adopted. Also can with the function CheckButton() too with CreateButton() erstellte Buttons quizzed go.
in this Version have so did i whom piece of advice of IF berücksichtigt. New is too The function CButton(), with the one Buttons create can, which as an CheckBox einrasten let - So how one switch.

though must I moreover say, that one with the actually Version little Geschwindigkeitsverluste in buy take must. the lying on it, that the inquire the API Getdlgctrlid() something longer lasts. but who in its Program anyhow one WaitInput uses, the can it alike his.
with the function Clicked() can though no the both versions mithalten, however is it of my Wissens to futile Clicked() in a Loop without WaitInput or WaitMouse To use.

means falls this disadvantage Schonmal out

who no Profan 9 has can itself self The function Clicked() create:
CompileMarkSeparation
 
WinXP Pro SP2, XProfan 9 + XPSE
AMD Athlon 64 X2 3800
10/06/05  
 



Huch - The Api GetDlgCtrlID  is Yes even already in the OnlineDoku gelistet.
 
10/06/05  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

8.648 Views

Themeninformationen

this Topic has 2 subscriber:

Peter Mallow (3x)
iF (2x)


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