Buchempfehlung
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Mikrocomputertechnik mit Controllern der Atmel AVR-RISC-Familie
Umfassend, aber leicht verständlich führt dieses Buch in die Programmierung von ATMEL AVR Mikrocontrollern ein. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Kleine GUI(Buttons,unbewegbare Fenster, Textboxen)

Uploader:MitgliedWestbeam
Datum/Zeit:25.04.2010 17:10:02

dim shared as integer mousex,mousey,buttons,num2
dim shared as string taste

declare sub button(anfangx as integer,anfangy as integer,text as string,byval num as integer)
declare function buttonpressed(byval num as integer)as integer
declare sub CreateWindow(ax as integer,ay as integer,ex as integer,ey as integer,title as string,clr as integer)
declare sub TextBox(ax as integer,ay as integer,text as string,clr as integer)
declare sub Cursor()


sub Button(anfangx as integer,anfangy as integer,text as string,byval num as integer)
    dim as any ptr buttongfx,buttongfx2
    dim as integer textz
    textz=(Len(text)*8)+4
    buttongfx=imagecreate(textz+1,19)
    buttongfx2=imagecreate(textz+1,19)
    line buttongfx,(0,0)-(textz,18),7,BF
    line buttongfx,(0,0)-(textz,0),15
    line buttongfx,(0,0)-(0,16),15
    line buttongfx,(1,17)-(textz,17),8
    line buttongfx,(textz-1,18)-(textz-1,1),8
    line buttongfx,(0,18)-(textz,18),254
    line buttongfx,(textz,18)-(textz,0),254
    color 254
    draw string buttongfx,(3,2),text
    color 254
    line buttongfx2,(0,0)-(textz,18),7,BF
    line buttongfx2,(0,0)-(textz,0),254
    line buttongfx2,(0,0)-(0,16),254
    line buttongfx2,(1,1)-(textz,1),8
    line buttongfx2,(1,1)-(1,17),8
    line buttongfx2,(0,18)-(textz,18),15
    line buttongfx2,(textz,18)-(textz,0),15
    color 254
    draw string buttongfx2,(4,3),text
    color 254
    Put (anfangx,anfangy),buttongfx,pset
    if (mousex>anfangx and mousex<anfangx+textz and mousey>anfangy and mousey<anfangy+18 and buttons=1) then
    Put (anfangx,anfangy),buttongfx2,pset
    num2=num
    end if
end sub

function Buttonpressed(byval num as integer)as integer
        If num=num2 Then
                Return num
        Else
                Return 0
        End If
end function

sub CreateWindow(ax as integer,ay as integer,ex as integer,ey as integer,title as string,clr as integer)
    'dim as integer schieb
    line (ax,ay)-(ex,ey),clr,BF
    line (ax,ay)-(ex,ey),254,B
    line (ax,ay+19)-(ex,ay+19),254,B
    line (ax+1,ay+1)-(ex-1,ay+19),149,BF
    color 15
    draw string (ax+3,ay+2),title
end sub

sub Cursor()
    taste=inkey
    getmouse mousex,mousey,,buttons
end sub

sub TextBox(ax as integer,ay as integer,text as string,clr as integer)
    dim as integer textz=(Len(text)*8)+4
    line (ax,ay)-(ax+textz,ay+16),clr,BF
    line (ax,ay)-(ax+textz,ay),8
    line (ax,ay)-(ax,ay+16),8
    line (ax+textz,ay)-(ax+textz,ay+16),15
    line (ax,ay+16)-(ax+textz,ay+16),15
    color 254
    draw string (ax+3,ay+2),text
end sub