Problem with OK Button
Übersicht

Walter StevensBetreff: Problem with OK Button |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hi!
I have a little problem. The OK Button in my program doesn't work. It or TextArea. I don't know, because I'm new at programming in Blitz Plus. Here's a code: Code: [AUSKLAPPEN] Function CenterWindow (title$, width, height, group = 0, style = 15)
Return CreateWindow (title$, (ClientWidth (Desktop ()) / 2) - (width / 2), (ClientHeight (Desktop ()) / 2) - (height / 2), width, height, group, style) End Function Function MyCls() Color 236,233,216 Rect 380,114,623,603 Color 0,0,0 End Function Global width=740,height=680 window = CenterWindow ("Game Producer 2D by Monterran Games", width, height) SetBuffer DesktopBuffer() panel = CreatePanel (0,0,150,600,window,0) SetGadgetLayout panel,1,0,1,0 actualprojectbutton = CreateButton("Aktualny projekt",5,5,100,30,panel) myprojectsbutton = CreateButton("Moje projekty",5,45,100,30,panel) makeprojectbutton = CreateButton("Stwórz projekt",5,85,100,30,panel) buybutton = CreateButton("Kup",5,125,100,30,panel) workersbutton = CreateButton("Pracownicy",5,165,100,30,panel) publicitybutton = CreateButton("Reklama",5,205,100,30,panel) marketbutton = CreateButton("Rynek",5,245,100,30,panel) actionbutton = CreateButton("Działania",5,285,100,30,panel) awardsbutton = CreateButton("Nagrody",5,325,100,30,panel) e3button = CreateButton("Targi E3",5,365,100,30,panel) bankbutton = CreateButton("Bank",5,405,100,30,panel) savebutton = CreateButton("Zapisz grę",5,445,100,30,panel) loadbutton = CreateButton("Wczytaj grę",5,485,100,30,panel) newgamebutton = CreateButton("Nowa gra",5,525,100,30,panel) infobutton = CreateButton("Info",5,565,100,30,panel) URLgo = CreateButton ("GO!",620,10,60,20,panel) font=LoadFont("Arial",16) SetFont font Global gamestarted,name,okbuttonforstudio Repeat Color 0,0,0 Select EventID() Case $401 ;Button events Select EventSource() Case actualprojectbutton MyCls() If gamestarted=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case myprojectsbutton MyCls() If gamestarted=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case makeprojectbutton MyCls() If gamestarted=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case buybutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case workersbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case publicitybutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case marketbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case actionbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case e3button MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case bankbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case savebutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case loadbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case newgamebutton MyCls() Text 600,360,"Wprowadz nazwe studia:" name = CreateTextArea(150,270,540,20,window) okbuttonforstudio = CreateButton("OK",350,300,100,30,window) ; PROBLEM IS HERE! OK BUTTON DOESN'T WORK! Select EventID() Case $401 Select EventSource Case okbuttonforstudio gamestarted=1 MyCls() Text 550,200,TextAreaText(name) End Select End Select Case infobutton MyCls() Text 600,340,"Game Producer 2D" Text 550,360,"Copyright (c) 2008, Walter Stevens" Text 602,380,"Monterran Games" Text 615,400,"Version 0.8.0" Text 608,420,"25 August 2008" End Select End Select Flip Until WaitEvent () = $803 End Place where problem is I signed by a comment. When you run program, click on "Nowa gra" (it's down on a window). Then type any name (like Crytek, Electronic Arts...) and click OK. Doesn't work. Why? Best regards |
||
![]() |
Starwar |
![]() Antworten mit Zitat ![]() |
---|---|---|
Aloha,
You will never get an event sent by this ok button, because the button will only be checked if the newgamebutton is pressed. and it can`t be pressed at the same time as the ok button... Code: [AUSKLAPPEN] Repeat WaitEvent () Color 0,0,0 Select EventID() Case $401 ;Button events Select EventSource() Case actualprojectbutton MyCls() If gamestarted=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case myprojectsbutton MyCls() If gamestarted=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case makeprojectbutton MyCls() If gamestarted=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case buybutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case workersbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case publicitybutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case marketbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case actionbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case e3button MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case bankbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case savebutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case loadbutton MyCls() If gamestrated=0 Text 600,381,"Nie rozpoczales nowej gry!" End If Case newgamebutton MyCls() Text 600,360,"Wprowadz nazwe studia:" name = CreateTextArea(150,270,540,20,window) okbuttonforstudio = CreateButton("OK",350,300,100,30,window) Case okbuttonforstudio gamestarted=1 MyCls() Notify TextAreaText(name) Case infobutton MyCls() Text 600,340,"Game Producer 2D" Text 550,360,"Copyright (c) 2008, Walter Stevens" Text 602,380,"Monterran Games" Text 615,400,"Version 0.8.0" Text 608,420,"25 August 2008" End Select End Select (Not the full code, only main loop) [offtopic] Please do NOT use the desktop buffer! often gadgets are not removed, moved or even created in the right way. Cls in DestopBuffer clears the wohle screen! if you want a window without a titelbar use Null as style. For simply showing a message use Notify And please do write your program texts in German or English. We want to know what you are coding . ![]() [/offtopic] MFG, bye |
||
Walter Stevens |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
First of all - thank you ![]() As you can see my project is in very early stadium, so for now it's only in polish. But I'll add english language ![]() Cls? There's no Cls... Only my function - MyCls() ![]() Well, desktop buffer is for now good because I don't use any gadgets or something like that and I won't use. And it don't move any thing at right (I don't know what you meant). But backbuffer shows errors, so I couldn't use it. I searched and found desktop buffer. Oh, I forgot ![]() |
||
![]() |
Eingeproggt |
![]() Antworten mit Zitat ![]() |
---|---|---|
I think Canvas will be the right gadget for your purpose. (CreateCanvas, FlipCanvas)
Please see the english manual for details. It wont be helpful if I give you the german manual I think ![]() EDIT: Or, as Starwar said, use Notify and forget all graphic commands. greetings, Christoph |
||
Gewinner des BCC 18, 33 und 65 sowie MiniBCC 9 |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group