forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Custom Caret

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code
View previous topic :: View next topic  
Author Message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Tue Oct 26, 2004 10:54 pm    Post subject: Custom Caret Reply with quote

This will change the caret(the blinking line in an editbox) of your edit control.
The example requires a 16x16 BMP(a sample is attached to this post, it's extension was changed to JPG so it could be attached), it looks in the path of your script for it. Caret colors are inverted, so make sure you save it as the inverse of the colors you actually want to show up.
Code:

  DIALOG CREATE,Custom Caret,-1,0,240,62
  DIALOG ADD,EDIT,EDIT1,17,31,180,24
 
  %%focused = 0
  %%bmppath = @PATH(%0)cursor.bmp
  %%caretwidth = 16
  %%caretheight = 16
  LOADLIB user32.dll
  REM *** Load the cursor bitmap
  REM *** $010 = LR_LOADFROMFILE
  %%carethandle = @LIB(user32,LoadImageA,INT:,INT:0,STR:%%bmppath,INT:0,INT:%%caretwidth,INT:%%caretheight,INT:$010)
  %%hwnd = @STRDEL(@WINEXISTS(~EDIT1),1,1)
 
  DIALOG SHOW
:Timer
  REM *** ReCreate the caret each time the edit receives focus, or else it reverts to the normal one.
  %%focusedhwnd = @LIB(user32,GetFocus,INT:,NIL:)
  if @EQUAL(%%focusedhwnd,%%hwnd)
    REM *** Make sure we are "regaining" the focus, and didn't already have it
    if @EQUAL(%%focused,0)
      %%return = @LIB(user32,HideCaret,INT:,INT:%%hwnd)
      %%return = @LIB(user32,CreateCaret,INT:,INT:%%hwnd,INT:%%carethandle,INT:%%caretwidth,INT:%%caretheight)
      %%return = @LIB(user32,ShowCaret,INT:,INT:%%hwnd)
      %%focused = 1
    end
  else
    %%return = @LIB(user32,HideCaret,INT:,INT:%%hwnd)
    %%return = @LIB(user32,DestroyCaret,INT:,NIL:)
    %%focused = 0
  end
:evloop
  wait event,0.2
  goto @event()
:Close
  LOADLIB Gdi32.dll
  %%return = @LIB(Gdi32,DeleteObject,INT:,INT:%%carethandle)
  FREELIB Gdi32.dll
  FREELIB user32.dll
  exit



cursor.jpg
 Description:
 Filesize:  822 Bytes
 Viewed:  5431 Time(s)

cursor.jpg



_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Fri Oct 29, 2004 1:20 am    Post subject: Reply with quote

That's a nice script. Excellent job. Very Happy

Also regarding the attachments, I will add .BMP files to the allow list. Smile

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group