Hi there,
Im trying to hide caret on all controls from my windows… i declared HideCaret from user32 api, but i guess something is missing… can someone give me an idea?
best regards
Hi there,
Im trying to hide caret on all controls from my windows… i declared HideCaret from user32 api, but i guess something is missing… can someone give me an idea?
best regards
It is not enough to declare HideCaret, you should call it.
Sorry i declare HideCaret and call it as well:
After Open() method
loc:hwnd = QuickWindow{PROP:Handle}
ret# = HideCaret(loc:hwnd)
HideCaret expects a handle of a window which owns the caret, for example ENTRY or TEXT:
loc:hwnd = ?ENTRY1{PROP:Handle}
ret# = HideCaret(loc:hwnd)
Still not working…
My module declaration is:
Module('Windows')
HideCaret(*LONG),LONG,PASCAL,DLL(1)
End
Well, your declarartion is wrong.
Your declaration should be
HideCaret(long hWnd),long,raw,pascal,name(‘HideCaret’)
Following code will hide/show the caret in ?ENTRY1 whilst leaving the other caret unaffected…
PROGRAM
MAP
module('win')
HideCaret(long hWnd),long,raw,pascal,name('HideCaret')
ShowCaret(long hWnd),long,raw,pascal,name('ShowCaret')
end
END
Window WINDOW(‘Caption’),AT(,260,100),CENTER,GRAY,AUTO,SYSTEM,FONT(‘Segoe UI’,9)
ENTRY(@s20),AT(86,21),USE(?ENTRY1)
ENTRY(@s20),AT(86,43),USE(?ENTRY2)
BUTTON(‘Hide’),AT(110,71),USE(?btnHideShow)
END
result ulong
CODE
open(Window)
accept
case field()
of ?btnHideShow
case event()
of EVENT:Accepted
case ?btnHideShow{PROP:Text}
of 'Hide'
?btnHideShow{PROP:Text} = 'Show'
result = HideCaret(?ENTRY1{PROP:Handle})
message('result ' & result,'Hiding')
of 'Show'
?btnHideShow{PROP:Text} = 'Hide'
result = ShowCaret(?ENTRY1{PROP:Handle})
message('result ' & result,'Showing')
end
end
end
end
close(Window)
If you want to hide for all controls look at PROP:NextField in the Help
You’d need to iterate through all the controls checking PROP:Type and only do the hiding for controls that can actually have a caret.
Hmm, actually I don’t think this will work after all because as soon as you select the control again the caret reappears.
Maybe in Clarion the controls don’t own the caret?
What are you trying to achieve?
In fact HideCaret always returns zero which means it’s failed.
Thank you very much Graham_Dawson for your answer ,
i’d tried
Module('Windows')
HideCaret(LONG),LONG,PASCAL,DLL(1)
End
and worked, but it will better as your way, im learning using apis.
I’ve seen that but my UI doesnt use clicks so it works for me
Thank you