Posted: Fri Jul 05, 2002 5:07 am
Restored from previous forum. Originally posted by Fangbeast.
I am using a combination of API and KeyboardShortcuts and it's getting a little messy. Could anyone help
translate this all into PureBasic only (for portability) because I need the events happening in the
specific gadgets and I keep getting the testing wrong (I don't know what the heck I am doing any more)
then I check for them all here
As it is, my program and code works great but for portability to other OS (I'm helping someone do this
stuff over for Unix), I need the PB shortcut methods and not the api.
Hope someone can help me put them i the right order
Fangles
I am using a combination of API and KeyboardShortcuts and it's getting a little messy. Could anyone help
translate this all into PureBasic only (for portability) because I need the events happening in the
specific gadgets and I keep getting the testing wrong (I don't know what the heck I am doing any more)
Code: Select all
#CategoryTree = 20
#ListBox = 21
#F1Code = 100
#DelCode = 101
getasynckeystate_(#VK_UP)
getasynckeystate_(#VK_DOWN)
getasynckeystate_(#VK_RETURN)
WinW = 806
WinH = 602
WinX = (GetSystemMetrics_(#SM_CXSCREEN) - WinW) / 2
WinY = (GetSystemMetrics_(#SM_CYSCREEN) - WinH) / 2
hWnd = OpenWindow(0, Random(WinX), Random(WinY), WinW, WinH, 0, Version$)
AddKeyboardShortcut(0, #PB_Shortcut_F1, #F1Code)
AddKeyboardShortcut(0, #PB_Shortcut_Delete, #DelCode)
Code: Select all
Repeat
EventID = WaitWindowEvent()
;- Main window events that don't fit anywhere else
If EventID = #PB_EventCloseWindow And SaveNow = 0
QuitValue = 1
ElseIf EventID = #PB_EventCloseWindow And SaveNow = 1
Fill_Statusbar(0, "Data changed recently, Save now?")
Code = MessageRequester("Data Changed", "Still Exit?", #MB_ICONQUESTION | #PB_MessageRequester_YesNo)
If Code = 6
QuitValue = 1
EndIf
EndIf
;- If ENTER key is pressed in the search target box
If GetGadgetText(#SearchBox) "" And GetFocus_() 0 And getasynckeystate_(#VK_RETURN) = -32767
Gosub Find_First
EndIf
;- Yet another test of this damned keyboard shortcuts
If EventID = #PB_EventMenu
Select EventMenuID()
Case #F1Code
Gosub Help_Wanted
Case #DelCode
Gosub Delete_Record
EndSelect
EndIf
;- Check for events in the window from gadgets
If EventID = #PB_EventGadget
Select EventGadgetID()
Case #CategoryTree ; TreeGadget
;- Up, down and left click events in the tree
If GetFocus_() 0 And getasynckeystate_(#VK_UP) = -32767
Gosub Display_Categories
ElseIf GetFocus_() 0 And getasynckeystate_(#VK_DOWN) = -32767
Gosub Display_Categories
EndIf
If EventType() = #PB_EventType_LeftClick
Gosub Display_Categories
EndIf
;- Up, down and left click events in the ListIcongadget
Case #ListBox ; ListIconGadget
If GetFocus_() 0 And getasynckeystate_(#VK_UP) = -32767
Create_Web_Report()
ElseIf GetFocus_() 0 And getasynckeystate_(#VK_DOWN) = -32767
Create_Web_Report()
EndIf
If EventType() = #PB_EventType_LeftClick And GetGadgetState(#ListBox) -1
Create_Web_Report()
EndIf
;- Special event, left double click to go to edit mode on highlighted record
If EventType() = #PB_EventType_LeftDoubleClick And GetGadgetState(#ListBox) -1
Mode$ = "Edit"
Gosub Add_Edit_Form
EndIf
;- Special event, right double click to add a new record to the end of the current list
If EventType() = #PB_EventType_RightDoubleClick
Mode$ = "Add"
Gosub Add_Edit_Form
EndIf
EndSelect
EndIf
Until Quit_Value = 1
End
stuff over for Unix), I need the PB shortcut methods and not the api.
Hope someone can help me put them i the right order
Fangles