UsedWindow()
Posted: Sun Jun 01, 2003 11:48 pm
And anywhere else you can "use" something, it would be nice to be able to find out what number of item is currently being "used".
EventWindowID()tinman wrote:And anywhere else you can "use" something, it would be nice to be able to find out what number of item is currently being "used".
EventWindowID() and EventGadgetID() only gives you a hint what was used IF there WAS an EVENT.ricardo wrote:EventWindowID()tinman wrote:And anywhere else you can "use" something, it would be nice to be able to find out what number of item is currently being "used".
EventGadgetID()
Does what you want, or maybe i don't understand you question.
But you can store it on a variable.EventWindowID() and EventGadgetID() only gives you a hint what was used IF there WAS an EVENT.
I suppose Tinman likes to see a command that tells him what was the last used Window or Gadget or whatever.
Something like a specialized GetFocus for each GUI control
Yes, it's very easy to do with something like this:ricardo wrote:But maybe he is asking for some command to know the actuall/selected window, i mean with UseWindow()
However, all this info can be stored in a variable
Code: Select all
DefType.l my_used_window : Global my_used_window
Procedure.l mUseWindow(window_number..l)
my_used_window = window_number
ProcedureReturn UseWindow(window_number)
EndProcedure
Procedure.l mUsedWindow()
ProcedureReturn my_used_window
EndProcedure
Code: Select all
Procedure UsedWindow()
result=-1
aktiveWindow=GetFocus_()
for i=0 to 100
if aktiveWindow=WindowID()
result=i:i=99999
endif
next
procedurereturn result
endprocedure
Code: Select all
Procedure UsedWindow()
result=-1
aktiveWindow=GetFocus_()
for i=0 to 100
if aktiveWindow=window(i):aktiveWindow=i
result=i:i=99999
endif
next
procedurereturn result
endprocedure
Code: Select all
Procedure UsedWindow()
result=-1
aktiveWindow=GetFocus_()
for i=0 to 100
if aktiveWindow=WindowID(i)
result=i:i=99999
endif
next
procedurereturn result
endprocedure
Code: Select all
OpenWindow(0,0,200,100,100,0,"hallo")
creategadgetlist(WindowID())
ButtonGadget(0,10,10,80,80,"TEST")
OpenWindow(1,200,200,10,10,0,"hallo2")
oldfocus=-1
Repeat
WindowEvent()
x=Getactivewindow_()
If oldfocus<>x
oldfocus=x
Debug oldfocus
EndIf
ForEver
Code: Select all
Procedure.l UsedWindow() ; returns WindowID() of current used window
!EXTRN _PB_Window_Current
!MOV EAX, dword [_PB_Window_Current]
ProcedureReturn
EndProcedure
Procedure.l UsedFile() ; returns HANDLE of current used File
!EXTRN _PB_File_Current
!MOV EAX, dword [_PB_File_Current]
ProcedureReturn
EndProcedure
Procedure.l UsedFont() ; returns HFONT of current used font
!EXTRN _PB_Font_Current
!MOV EAX, dword [_PB_Font_Current]
ProcedureReturn
EndProcedure
Procedure.l UsedMenu() ; returns HMENU of currenmt used menu
!EXTRN _PB_Menu_Current
!MOV EAX, dword [_PB_Menu_Current]
ProcedureReturn
EndProcedure
Procedure.l UsedDrawingDC() ; returns DC (Device Context) of current drawing operation
!EXTRN _PB_2DDrawing_CurrentDC
!MOV EAX, dword [_PB_2DDrawing_CurrentDC]
ProcedureReturn
EndProcedure
Procedure.l UsedImage() ; returns ImageID() of current used Image
!EXTRN _PB_Image_CurrentObject
!MOV EAX, dword [ _PB_Image_CurrentObject]
ProcedureReturn
EndProcedure
Who's that ;pfreak wrote:What they return is the actual object set by the Use...() function, just like timnam want's it :wink: