Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Specific character check in window
#1
I need to run a "checking". If two of my items are checked, I need to uncheck the previous one. So, all I need to do is to get the "character" (check in a check box) in two specific places (pixel) of my window and test whether they match or not. Now, how to do that? What is the function involved? I tried to check the color, but that isn't helping much since the pixel position cannot be specified that precisely under my situation.
#2
If these check boxes are in your own dialog, you could possible use something like mine at the bottom.
If these check boxes are on a webpage: you could use accessible objects, and check state with .State, and .DoDefaultAction if you need to toggle its status
If this does not work (due to all ID's being 0) you could check for the color at a window relative coordinate,
If this does not work you could scan for an image.
I believe there are even more ways but one of these should work.

If you post the specific website I could possibly help more.

Function Dialog14
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 227 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54012003 0x0 12 10 48 12 "Check"
;4 Button 0x54012003 0x0 12 30 48 12 "Check"
;5 Button 0x54012003 0x0 12 50 48 12 "Check"
;6 Button 0x54032009 0x0 86 10 48 12 "Option first"
;7 Button 0x54002009 0x0 86 24 48 12 "Option next"
;8 Button 0x54002009 0x0 86 38 48 12 "Option next"
;9 Button 0x54002009 0x0 86 52 48 13 "Option next"
;10 Button 0x54012003 0x0 154 12 48 13 "Check"
;11 Button 0x54012003 0x0 154 28 48 13 "Check"
;12 Button 0x54012003 0x0 154 44 48 13 "Check"
;13 Static 0x54000000 0x0 10 80 48 12 "Two Max"
;14 Static 0x54000000 0x0 86 82 48 12 "Option Buttons"
;15 Static 0x54000000 0x0 156 80 48 12 "One Max"
;17 Static 0x54000011 0x20000 142 10 1 68 ""
;16 Static 0x54000011 0x20000 72 12 1 70 ""
;END DIALOG
;DIALOG EDITOR: "" 0x203000B "" "" ""
str controls = "3 4 5 6 7 8 9 10 11 12"
str c3Che c4Che c5Che o6Opt o7Opt o8Opt o9Opt c10Che c11Che c12Che

if(!ShowDialog("Dialog14" &Dialog14 &controls)) ret  ;;make sure this matches your dialog
ret
;messages
sel message
,case WM_INITDIALOG
,int-- count
,int-- last = 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,;;max 2 choices
,case 3
,,if(!but(id(3 hDlg)))
,,,count - 1
,,else
,,,count + 1
,,,if last = 0
,,,,last = 3
,,,if(!but(id(last hDlg)))
,,,,last = 3
,,if count = 3
,,,but- id(last)
,,,if(but(id(4 hDlg)))
,,,,last = 4
,,,if(but(id(5 hDlg)))
,,,,last = 5
,case 4
,,if(!but(id(4 hDlg)))
,,,count - 1
,,else
,,,count + 1
,,,if last = 0
,,,,last = 4
,,,if(!but(id(last hDlg)))
,,,,last = 4
,,if count = 3
,,,but- id(last)
,,,if(but(id(3 hDlg)))
,,,,last = 3
,,,if(but(id(5 hDlg)))
,,,,last = 5
,case 5
,,if(!but(id(5 hDlg)))
,,,count - 1
,,else
,,,count + 1
,,,if last = 0
,,,,last = 5
,,,if(!but(id(last hDlg)))
,,,,last = 5
,,if count = 3
,,,but- id(last)
,,,if(but(id(4 hDlg)))
,,,,last = 4
,,,if(but(id(3 hDlg)))
,,,,last = 3
,
,;;with only 1 max choice
,
,case 10
,,if(but(id(10 hDlg)))
,,,if but(id(11 hDlg))
,,,,but- id(11 hDlg)
,,,if but(id(12 hDlg))
,,,,but- id(12 hDlg)
,,
,case 11
,,if(but(id(11 hDlg)))
,,,if but(id(10 hDlg))
,,,,but- id(10 hDlg)
,,,if but(id(12 hDlg))
,,,,but- id(12 hDlg)
,,
,case 12
,,if(but(id(12 hDlg)))
,,,,if but(id(11 hDlg))
,,,,,but- id(11 hDlg)
,,,,if but(id(10 hDlg))
,,,,,but- id(10 hDlg)
,,
,case IDOK
,case IDCANCEL
ret 1


Forum Jump:


Users browsing this thread: 1 Guest(s)