Qbasicnews.com

Full Version: Failed to create wx-cursor! Please help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Failed to create wx-cursor! Please help!
Give me a little sample!

Regards,
Forget it!
According wxwindows docs wxcursor is not yet complete implementetation because Class is platform dependent !
Solved problem using user32 - fuctions!(only for windows!!)
Code:
'$include: "win/user32.bi"
dim mycur as integer
mycur=LoadCursorFromFile(filename as string)
SetCursor(mycur)

Regards,
(sorry for being a day late Tongue)
no in fact wxCursor works fine... try this instead

Code:
'$include: "wx-c/wx.bi"
#define wxCLOSE_BOX &h1000
#define FALSE 0
#define TRUE NOT(FALSE)
option escape
dim shared wx_app as wxapp ptr,wx_frame as wxframe ptr

sub App_OnInit()
    wx_frame = wxFrame()
    wxFrame_Create(wx_frame,0,-1,"My WX-C Project",wxSize(440,312),wxSize(400,400),wxDEFAULT_FRAME_STYLE or wxCLOSE_BOX xor wxMAXIMIZE_BOX xor wxRESIZE_BORDER,"frame")
    wxWindow_SetBackgroundColour(wx_frame,wxSystemSettings_GetColour(15))
    dim as wxButton ptr m
    m=wxButton()
    wxButton_Create(m,wx_frame,-1,"here's a button\nmove your mouse\nover it to see\nthe cursor magick :P",wxSize(131,136),wxSize(-1,63),0,0,0)
    wxWindow_SetCursor(m,wxCursor_ctorById(wxCURSOR_SPRAYCAN))
    wxWindow_SetAutoLayout(wx_frame,TRUE)
    wxWindow_Show(wx_frame,1)
end sub

sub App_OnExit()
    wxapp_onexit(wx_app)
end sub

wx_app = wxApp()
wxApp_RegisterVirtual ( wx_app, @App_OnInit, @App_OnExit)
wxApp_Run(0,0)
end

(fyi, base code w/o cursor genned by visual wx-c developer, using that might help with some of the basic stuff, it's at http://m0n573r.afraid.org/visual_wx-c_designer.zip )
oh i see, you wanted to make a cursor out of an external file... whoops

it still works, but it's a bit different, you have to do it this way:

Code:
'$include: "wx-c/wx.bi"
#define wxCLOSE_BOX &h1000
#define FALSE 0
#define TRUE NOT(FALSE)
option escape
dim shared wx_app as wxapp ptr,wx_frame as wxframe ptr

sub App_OnInit()
    wx_frame = wxFrame()
    wxFrame_Create(wx_frame,0,-1,"My WX-C Project",wxSize(440,312),wxSize(400,400),wxDEFAULT_FRAME_STYLE or wxCLOSE_BOX xor wxMAXIMIZE_BOX xor wxRESIZE_BORDER,"frame")
    wxWindow_SetBackgroundColour(wx_frame,wxSystemSettings_GetColour(15))
    dim as wxButton ptr m
    m=wxButton()
    wxButton_Create(m,wx_frame,-1,"here's a button\nmove your mouse\nover it to see\nthe cursor magick :P",wxSize(131,136),wxSize(-1,63),0,0,0)
    dim myimg as wxBitmap ptr
    myimg=wxBitmap_ctorByName("c:/fb/images/button.bmp",wxBITMAP_TYPE_BMP)
    wxWindow_SetCursor(m,wxCursor_ctorImage(wxBitmap_ConvertToImage(myimg)))
    wxWindow_SetAutoLayout(wx_frame,TRUE)
    wxWindow_Show(wx_frame,1)
end sub

sub App_OnExit()
    wxapp_onexit(wx_app)
end sub

wx_app = wxApp()
wxApp_RegisterVirtual ( wx_app, @App_OnInit, @App_OnExit)
wxApp_Run(0,0)
end
Tahnks for reply!
I was making some mistakes!
Thanks very much again!

Best regards,

Nicolae