that annoying little window icon

Blitz3D Forums/Blitz3D Beginners Area/that annoying little window icon

Yahfree(Posted 2007) [#1]
Hey, ResH changes the .EXE icon and changes it down in the task bar, but if your application is like mine, you run it in windowed mode, then theres a problem: Theres an ugly Standard windows icon up top in the title bar...

How do i change this? :(


Danny(Posted 2007) [#2]
You could use WinBlitz3D to change the icon of your window at runtime... www.winblitz3d.co.uk


b32(Posted 2007) [#3]
edit: my idea didn't work .. nm


Yahfree(Posted 2007) [#4]
Whats WinBlitz3D? no features or abouts on that website...


Yahfree(Posted 2007) [#5]
Oooh, i downloaded it, wow this is neat, i have a few questions:

* how do i use this to change the icon.

* any tutorials on this? its pretty neat.

* do i have to distribute the DLL with the download of my program? or can they stay on my hardrive under b3d\userlibs?

* Can this be used to change the icon on an B3d window? or only a "winb3d" created window?

* can i use these gui functions on a normal b3d window? or do i have to create a new "Winb3d" window ?


Kev(Posted 2007) [#6]
Hi Yahfree


* how do i use this to change the icon.



the following code changes the runtime window's icon.
icons = WB3D_LoadIconStrip("icons.bmp",16,0)
WB3D_SetWindowIcon(SystemProperty("AppHwnd"),icons,0)



* any tutorials on this? its pretty neat.



simple one here for setting up and creating a window under winblitz3d.
http://www.winblitz3d.co.uk/forum/viewtopic.php?t=112

no more offical ones at the moment, not sure if theres any floating around the blitz community though.


* do i have to distribute the DLL with the download of my program? or can they stay on my hardrive under b3d\userlibs?



yes you need to distribute winblitz3d with any .exe that call's any function within the .dll.


* Can this be used to change the icon on an B3d window? or only a "winb3d" created window?


see the above code for changing the runtimewindow icon.


* can i use these gui functions on a normal b3d window? or do i have to create a new "Winb3d" window ?



all gadgets can be used direct in the runtimewindow.

kev


Yahfree(Posted 2007) [#7]
I like this... The "kev" under examples tells me your the creator i think.. So "SystemProperty("AppHwnd")" calls the standard blitz3d runtime window?


also if you could give me a example that places a few gadgets on a standard blitz window that'd be awsome..

also one last thing: How do you access these window GUI's? thru the win32 DLL?


Kev(Posted 2007) [#8]
Hi


I like this... The "kev" under examples tells me your the creator i think.. So "SystemProperty("AppHwnd")" calls the standard blitz3d runtime window?



yes i wrote winblitz3d, SystemProperty() returns the HWND pointer to the blitz3d runtime window. this is required for calling WB3D_SetWindowIcon() and most other wb3d commands.


also if you could give me a example that places a few gadgets on a standard blitz window that'd be awsome



see my post here, it contains an example that uses most gadgets in winblitz3d.

http://www.winblitz3d.co.uk/forum/viewtopic.php?t=91


also one last thing: How do you access these window GUI's? thru the win32 DLL?



all commands are direct api call's.

kev


Yahfree(Posted 2007) [#9]
thank you kev


Yahfree(Posted 2007) [#10]
Heres a random question: How do i close an window and not close the main window? : in this example it closes the main window when you click the X on the example window:

; were using external winapi styles 
Include "WB3DStyles.bb" 

; setup gfx mode. 
Graphics 640,480,16,2 

; install winblitz3d. 
Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),200,500,640,480) 

; create our window 
example_window = WB3D_CreateWindow("Example Tutorial Window",300,200,200,200,0,0) 

; cleanup any old creation events, its better to do this before we enter the main 
; event loop, when some gadgets are created they generate events. 
WB3D_FlushEvents 
  
; setup out quit flag, and loop until the flag is set. 
QUIT = 0 
While Not QUIT = 1 

   ; get an event of the event queue. 
   event = WB3D_WaitEvent() 
   Select event    
                
      Case WB3D_EVENT_WINDOW_CLOSE 
       
         ; wb3d_eventsource hold the handle to the window that close button was selected 
         window = WB3D_EventSource() 
         Select window 
             
            Case RuntimeWindow_hWnd 
               ; set the flag to leave the loop. 
               QUIT = 1 
                
            Case example_window 
                
               ; set the flag To leave the loop. 
               QUIT = 1 
                
         End Select 

   End Select 
Delay 10

Wend 

; use notify using external winapi constants. 
;WB3D_Notify "WB3D GUI Window Example","Bye, Thats It I Quit",MB_OK Or MB_ICONASTERISK 
WB3D_EndGUI() 
EndGraphics 
End 



Kev(Posted 2007) [#11]
Hi Yahfree

QUIT = 1 is being used as a flag to end program execution, rem or remove QUIT = 1 from 'Case example_window' and the window will close, to show it again call WB3D_ShowGadget()

kev


Yahfree(Posted 2007) [#12]
cool, i'm still trying to understand the init_gui thingy... i tried this on one of my projects:

Graphics 500,400,16,2
SetBuffer BackBuffer()

Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),200,500,500,400)

icons = WB3D_LoadIconStrip("Media\icons.bmp",32,0)
WB3D_SetWindowIcon(SystemProperty("AppHwnd"),icons,0)


it looks like it cuts off part of the window

also when i try to use ESC to leave the prog (i use a While not keyhit(1) loop)

it gives me a error saying BlitzCC has an error has to close, send/don send


Kev(Posted 2007) [#13]
Hi Yahfree

if your only changing the icon within the blitz3d window then you dont need to call WB3D_InitializeGUI().

however if your using GUI within your program and you want to call WB3D_InitializeGUI() you should modify your main loop to take into account the new event handling.

a very basic loop would look like this.

; setup out quit flag, and loop until the flag is set. 
QUIT = 0 
While Not QUIT = 1 
	
	Cls
	
	
	Flip
	
   	; get an event of the event queue. 
   	event = WB3D_WaitEvent() 
   	Select event    

		Case WB3D_EVENT_KEYPRESS
		
			; wb_eventdata holds the key code that was pressed.
			keypressed = WB3D_EventData()
			
			Select keypressed
				
				Case WB3D_KEY_ESCAPE	
					
					; set the flag to leave the loop.
					QUIT = 1
					
			End Select
                
      	Case WB3D_EVENT_WINDOW_CLOSE 
       
        	; wb3d_eventsource hold the handle to the window that close button was selected 
         	window = WB3D_EventSource() 
         	Select window 
             
            	Case RuntimeWindow_hWnd 
               		; set the flag to leave the loop. 
               		QUIT = 1 

         End Select 

   End Select 

Wend 



all future keystrokes come through WB3D_EVENT_KEYPRESS event, you also are required to call WB3D_EndGUI() before calling End.

WB3D_EndGUI() 
EndGraphics 
End 


doing the above will mean smooth intergration between blitz3d and winblitz3d without any errors.


it looks like it cuts off part of the window



make sure you define WB3D_InitializeGUI() width and height the same as Graphics width and height. if you have more info please.

kev


Yahfree(Posted 2007) [#14]
Strange, i had to do this to make it display right:

Graphics 500,400,16,2
SetBuffer BackBuffer()

Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),200,500,506,437)


notice how width has 6 more pixels, and height has 37 more pixels

that key thing did resolve it, but i have 2 loops, 1 is for the enter screen, 1 is for the main screen, i tried putting that code into the first loop, it works, then i put it into the second loop, it still works, but when i go to the second screen, it doesnt work.

Also i notice a winb3d message thrown up when i click the X... how do i get rid of this?

last: how do i make it so the prog pops up in the center of the screen on dif pcs? i tried: Graphicswidth/2,Graphicsheight/2

that didnt work.. for ref this is the code i put into the 2 loops:

   event = WB3D_WaitEvent() 
   Select event    

	Case WB3D_EVENT_KEYPRESS
		
			; wb_eventdata holds the key code that was pressed.
			keypressed = WB3D_EventData()
			
			Select keypressed
				
				Case WB3D_KEY_ESCAPE	
					
					; set the flag to leave the loop.
					             WB3D_EndGUI() 
End   
					
			End Select

                
      Case WB3D_EVENT_WINDOW_CLOSE 
       
         ; wb3d_eventsource hold the handle to the window that close button was selected 
         window = WB3D_EventSource() 
         Select window 
             
            Case RuntimeWindow_hWnd 
               ; set the flag to leave the loop. 

             WB3D_EndGUI() 
End   
                
         End Select 

   End Select 


Thanks for the help kev, Awsome product.

Edit: And does this use bmp as icon thingy support alpha?


Yahfree(Posted 2007) [#15]
this is strange, i tried to solo out the bug, didnt work, ah well... i guess its because my program wasnt based around your dll so its confliction with stuff, aw well, all i really needed for this program was a change in the icon, but i think i'll keep this for other projects:

but i'm still wondering about the other 2 questions :

(width,height wierdness)+(how to place the open up window when it pops up in the middle of the screen, always)

C++ is complacated, i'm still trying to learn it, more motivated now, because i know what it can add to b3d..

oh and that last question: does this use bmp as icon thingy support alpha

EDIT*** Also forgot the strange WinB3d runtime error when i close the program, how do i disable this?

EDIT2*** not sure if this is my fault or a bug, but i try to pick a style other than default "0" from the styles .bb page, and it works, but it places the gadget up at 0,0 not even in a window... regardless of picked-window/picked x,y

it seems to make a new window (not really, just shows up on my task bar)


Kev(Posted 2007) [#16]
Hi Yahfree

ive had reports that the display offset is a little buggy, not had time to look into this yet.


Also i notice a winb3d message thrown up when i click the X... how do i get rid of this?



are you using version 1.0, beta 1.1 no longer has this. download and use beta v1.1


last: how do i make it so the prog pops up in the center of the screen on dif pcs? i tried: Graphicswidth/2,Graphicsheight/2



Function WB3D_MakeCenter(window)
	x=WB3D_GadgetWidth(WB3D_DeskTop())
    y=WB3D_GadgetHeight(WB3D_DeskTop())
	width = WB3D_GadgetHeight(window)
	height = WB3D_GadgetHeight(window)
	x=x/2-width/2
    y=y/2-height/2
	WB3D_SetGadgetShape window,x,y,width,height
End Function



And does this use bmp as icon thingy support alpha?


sorry no alpha support yet.


not sure if this is my fault or a bug, but i try to pick a style other than default "0" from the styles .bb page, and it works, but it places the gadget up at 0,0 not even in a window... regardless of picked-window/picked x,y



you will need to use WS_CHILD style to make any gadgets children of your window.

kev


Yahfree(Posted 2007) [#17]
Interesting.. yeah i downloaded th ebeta and i went away, 2 problems with that function, it reads width and height wrong( i fixed that by replace the WB3D_gadgetW/H commands with the raw data, second thing wrong is i create a window (runtime thingy) then it jumps over from the center window function, making a ugly flicker,

i tried putting in the raw data to the initGUI thing:

Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),WB3D_GadgetWidth(WB3D_DeskTop())/2-width/2,WB3D_GadgetHeight(WB3D_DeskTop())/2-height/2
,646,480)


also if i use WS_CHILD as a style for the text area, then whats the point? i cant pick a style..

heres what i use to make the textarea:
tex=WB3D_CreateTextArea(100,100,150,150,RuntimeWindow_hWnd,ES_PASSWORD)


also do you know by chance how to retrieve what the user types into a text area?

i tried this:

"Text 50,50,tex"

jump a bunch of numbers :(

thanks for your time kev.


Kev(Posted 2007) [#18]

2 problems with that function, it reads width and height wrong( i fixed that by replace the WB3D_gadgetW/H commands with the raw data, second thing wrong is i create a window (runtime thingy) then it jumps over from the center window function, making a ugly flicker,



my mistake, i quickly wrote the function without testing.


also if i use WS_CHILD as a style for the text area, then whats the point? i cant pick a style..



WS_CHILD is required when creating child gadgets, consider the main blitz3d window as the parent and we want child gadgets within the window. styles can be combined using 'Or' to make use for all winapi constant's.


also do you know by chance how to retrieve what the user types into a text area?



use WB3D_TextAreaText() to grab the full content of the textarea.

you might want to use WB3D_CreateEditField() for single line edit gadgets. WB3D_TextAreaText() uses multi line features for say a text editor. to get the text typed into WB3D_CreateEditField() gadgets use WB3D_GetGadgetText()

here's an example
; were using external winapi styles 
Include "WB3DStyles.bb" 

width = 800
height = 600

; setup gfx mode. 
Graphics width,height,16,2
 
; install winblitz3d. 
Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),WB3D_GadgetWidth(WB3D_DeskTop())/2-width/2,WB3D_GadgetHeight(WB3D_DeskTop())/2-height/2,width,height)

tex=WB3D_CreateEditField("",100,100,150,20,RuntimeWindow_hWnd,WS_CHILD Or ES_PASSWORD,0)

; cleanup any old creation events, its better to do this before we enter the main 
; event loop, when some gadgets are created they generate events. 
WB3D_FlushEvents 
  
; setup out quit flag, and loop until the flag is set. 
QUIT = 0 
While Not QUIT = 1 
	
	Cls
	
	
	Flip
	
   	; get an event of the event queue. 
   	event = WB3D_WaitEvent() 
   	Select event    

		Case WB3D_EVENT_KEYPRESS
		
			; wb_eventdata holds the key code that was pressed.
			keypressed = WB3D_EventData()
			
			Select keypressed
				
				Case WB3D_KEY_ENTER
					WB3D_Notify "Gadget contents!",WB3D_GetGadgetText(tex),0
					
				Case WB3D_KEY_ESCAPE	
					
					; set the flag to leave the loop.
					QUIT = 1
					
			End Select
                
      	Case WB3D_EVENT_WINDOW_CLOSE 
       
        	; wb3d_eventsource hold the handle to the window that close button was selected 
         	window = WB3D_EventSource() 
         	Select window 
             
            	Case RuntimeWindow_hWnd 
               		; set the flag to leave the loop. 
               		QUIT = 1 

         End Select 

   End Select 

Wend 

; use notify using external winapi constants. 
;WB3D_Notify "WB3D GUI Window Example","Bye, Thats It I Quit",MB_OK Or MB_ICONASTERISK 
WB3D_EndGUI() 
EndGraphics 
End 


kev


Yahfree(Posted 2007) [#19]
cool.


Yahfree(Posted 2007) [#20]
key kev, how do i get the current selected item out of a dropdown... i tried this case under Selected, and selected is under WB3D_EVENT_GADGET:

				Case slot
				
				cur_slotpick=WB3D_SelectGadgetItem(slot,0)
				
				If cur_slotpick="slot1" pickedslot=1
				If cur_slotpick="slot2" pickedslot=2
				If cur_slotpick="slot3" pickedslot=3


it doesnt work.. i displayed pickslot to make sure.

Also... i'm trying to make a EditField accept numbers only not letters.


Kev(Posted 2007) [#21]
Hi Yahfree.

use WB3D_SelectedGadgetItem() to obtain the currently selected item. the index returned can be used with WB3D_GadgetItemText()


Also... i'm trying to make a EditField accept numbers only not letters.


use ES_NUMBER style.

eg.
WB3D_CreateEditField("",100,100,150,20,RuntimeWindow_hWnd,WS_CHILD Or ES_NUMBER,0)


kev


Yahfree(Posted 2007) [#22]
can you give me an example of the selected thingy? thanks


Kev(Posted 2007) [#23]
Hi Yahfree

; were using external winapi styles 
Include "WB3DStyles.bb" 

width = 800
height = 600

; setup gfx mode. 
Graphics width,height,16,2
 
; install winblitz3d. 
Global RuntimeWindow_hWnd = WB3D_InitializeGUI(SystemProperty("AppHwnd"),WB3D_GadgetWidth(WB3D_DeskTop())/2-width/2,WB3D_GadgetHeight(WB3D_DeskTop())/2-height/2,width,height)


combo = WB3D_CreateComboBox(100,100,200,120,RuntimeWindow_hWnd,0)
For loop = 0 To 10
	WB3D_AddGadgetItem combo,"item "+loop,0,0
Next
WB3D_SelectGadgetItem combo,0

; cleanup any old creation events, its better to do this before we enter the main 
; event loop, when some gadgets are created they generate events. 
WB3D_FlushEvents 
  
; setup out quit flag, and loop until the flag is set. 
QUIT = 0 
While Not QUIT = 1 
	
	Cls
	
	
	Flip
	
   	; get an event of the event queue. 
   	event = WB3D_WaitEvent() 
   	Select event    
		
		Case WB3D_EVENT_GADGET
			Select WB3D_EventSource()
				Case combo
					item_selected = WB3D_SelectedGadgetItem(combo) 
					WB3D_Notify "",WB3D_GadgetItemText(combo,item_selected),0

			End Select
		Case WB3D_EVENT_KEYPRESS
		
			; wb_eventdata holds the key code that was pressed.
			keypressed = WB3D_EventData()
			
			Select keypressed
				
				
					
				Case WB3D_KEY_ESCAPE	
					
					; set the flag to leave the loop.
					QUIT = 1
					
			End Select
                
      	Case WB3D_EVENT_WINDOW_CLOSE 
       
        	; wb3d_eventsource hold the handle to the window that close button was selected 
         	window = WB3D_EventSource() 
         	Select window 
             
            	Case RuntimeWindow_hWnd 
               		; set the flag to leave the loop. 
               		QUIT = 1 

         End Select 

   End Select 

Wend 

; use notify using external winapi constants. 
;WB3D_Notify "WB3D GUI Window Example","Bye, Thats It I Quit",MB_OK Or MB_ICONASTERISK 
WB3D_EndGUI() 
EndGraphics 
End 


kev