October 30, 2020, 09:51:36 pm

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Recent posts

Pages1 2 3 ... 10
1
General Questions / FILEREQUEST Set to specific fi...
Last post by Andy - Today at 12:09:40 am
I was just looking at loading files again, and I could be mistaken but did I see someone on here trying to set FILEREQUEST to a specific file?

If so, I can't find it here.

Has anyone tried to do this, if so, did it work? and could you show me an example please?

Thanks,
Andy.
2
GUI Central / Re: Fun with Windows
Last post by Andy - October 28, 2020, 04:19:07 am
Good work Brian,

ZeroDog did some interesting things and it's always handy to keep a copy.

Thanks,
Andy.
3
GUI Central / Fun with Windows
Last post by Brian - October 27, 2020, 10:06:55 am
I was messing with ZeroDog's Fun with Windows examples, and have modified them to IWB format, all in the zip attached here

Brian
4
General Questions / Re: SendMessage not working?
Last post by Andy - October 14, 2020, 08:19:20 pm
Thanks Larry for clarifying the wording.

Me stupid!

I guess it's all down to my misinterpretation of the wParam explanation of EM_HIDESELECTION...

"Otherwise, the selection is hidden"

I took that to mean it would hide text, not remove the highlight.

Perhaps it should say:

"Otherwise, the highlight of the selection is removed" ?

Thanks for clearing it up in a way that my two brain cells can understand, and thanks again to Brian & Aurel who clearly understood it from the beginning.

Me stupid!

Andy.


 
5
General Questions / Re: SendMessage not working?
Last post by LarryMc - October 14, 2020, 04:26:22 pm
Andy
hideselection is another word for unseleclet  or unhilite
I modified your code and took out all the extra stuff (I could have taken out the subclass but I just left it there but it isn't needed in the example)

Code Select
$INCLUDE "windowssdk.inc"
$INCLUDE "richedit.inc"
' Tried with & without richedit.inc.

openconsole
int toggle

WINDOW w1
OPENWINDOW w1,0,0,900,600,@MINBOX|@MAXBOX|@SIZE|@CAPTION,0,"Window",&handler


CONTROL w1,@RICHEDIT,"",0,0,900,400,WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL|ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL,1

  SETFONT w1,"Arial",12,500,0,1
  setcontroltext(w1,1,"Mary had a little lamb. It's fleece was white as snow. And every where that Mary went the lamb was sure to go." + CHR$(13) + CHR$ (10))
  int rHandle = getcontrolhandle(w1,1)

CONTROL w1,@BUTTON,"Pick Selected Text",100,500,200,25,0,2
CONTROL w1,@BUTTON,"Toggle Selection ON/OFF",600,500,200,25,0,3
  setcaption w1,"RC Handle is " + str$(rHandle)

'================ - Here - =========================

const EM_HIDESELECTION = 0x43F ' 1087 decimal - (already defined in richedit.inc)

SubclassRichEdit(w1,1)

setfocus w1,1

WAITUNTIL IsWindowClosed(w1)
closeconsole
end

SUB SubclassRichEdit(parent as WINDOW,id as INT)
    hEdit = GETCONTROLHANDLE(parent,id)
    lpfn = SetWindowLongA(hEdit,-4,&RichEditHandler)
    SetPropA(hEdit,"edit_handler",lpfn)
RETURN
ENDSUB
SUB UnSubclassRichEdit(parent as WINDOW,id as INT)
    hEdit = GETCONTROLHANDLE(parent,id)
    SetWindowLongA(hEdit,-4,GetPropA(hEdit,"edit_handler"))
    RemovePropA(hEdit,"edit_handler")
RETURN
ENDSUB

SUB handler(),INT
 SELECT @MESSAGE
          CASE @IDCREATE
                CENTERWINDOW w1

          CASE @IDCLOSEWINDOW
                UnSubclassRichEdit(w1,1)
                CLOSEWINDOW w1

          CASE @IDCONTROL
                SELECT @CONTROLID
case 2
if @BN_CLICKED=0
int seltxt=int(rnd(0,95))
setfocus w1,1
SendMessageA(rHandle,EM_SETSEL,seltxt,seltxt+5)
endif
case 3
if @BN_CLICKED=0
if toggle=0 then
toggle=1
SendMessage(rHandle,EM_HIDESELECTION,toggle,0)
else
toggle=0
SendMessage(rHandle,EM_HIDESELECTION,toggle,0)
endif
endif
                endselect

    ENDSELECT
RETURN 0
ENDSUB

SUB RichEditHandler(hwnd:int,uMsg:int,wParam:int,lParam:pointer),int
    SELECT uMsg

    ENDSELECT

RETURN CallWindowProcA(GetPropA(hwnd,"edit_handler"),hwnd,uMsg,wParam,lParam)
ENDSUB
6
General Questions / Re: SendMessage not working?
Last post by Andy - October 13, 2020, 11:58:48 pm
Spent a few more hours on this and this is what I have found:

Here is the IWBasic test code:

Code Select
$INCLUDE "windowssdk.inc"
$INCLUDE "richedit.inc"
' Tried with & without richedit.inc.

openconsole

WINDOW w1
OPENWINDOW w1,0,0,500,400,@MINBOX|@MAXBOX|@SIZE|@CAPTION,0,"Window",&handler


'CONTROL w1,@RICHEDIT,"",0,0,500,400,0x50B010C4,1
CONTROL w1,@RICHEDIT,"",0,0,500,400,WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL|ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL,1
' Tried both styles just in case it was something to do with styles.

  SETFONT w1,"Arial",12,500,0,1
  setcontroltext(w1,1,"Hello" + CHR$(13) + CHR$ (10))
  int rHandle = getcontrolhandle(w1,1)

  setcaption w1,"RC Handle is " + str$(rHandle)

'================ - Here - =========================

const EM_HIDESEL = 0x13 ' 19 decimal  - tried 0x19 just in case...
const EM_HIDESELECTION = 0x43F ' 1087 decimal - (already defined in richedit.inc)

SubclassRichEdit(w1,1)
' Tried with sub classing the RE control as well as normal - sels not hidden.

SendMessage(rHandle,EM_SETSEL,0,5)
' Sets the selection okay.

setfocus w1,1
' Tried different combinations of SETFOCUS,
' e.g. Before selection, after selection, after hide selections - sels not hidden.

'OPTION 1:
'print SendMessageA(rHandle,EM_HIDESEL,1,0)
' Returns 1, leaves the highlight on, does not hide sels.

'OPTION 2:
print SendMessageA(rHandle,EM_HIDESELECTION,1,0)
' Returns 0, Destroys the highlight, does not hide sels.

' - Have also tried SendMessageW for options 1 & 2 - no difference.

'OPTION 3:
'print CONTROLCMD (w1,1,@rthidesel)
' Returns 0, Leaves the highlight on, does not hide sels.

setfocus w1,1
'=============================================

WAITUNTIL IsWindowClosed(w1)
closeconsole
end

SUB SubclassRichEdit(parent as WINDOW,id as INT)
    hEdit = GETCONTROLHANDLE(parent,id)
    lpfn = SetWindowLongA(hEdit,-4,&RichEditHandler)
    SetPropA(hEdit,"edit_handler",lpfn) 
RETURN
ENDSUB
SUB UnSubclassRichEdit(parent as WINDOW,id as INT)
    hEdit = GETCONTROLHANDLE(parent,id)
    SetWindowLongA(hEdit,-4,GetPropA(hEdit,"edit_handler"))
    RemovePropA(hEdit,"edit_handler")
RETURN
ENDSUB

SUB handler(),INT
 SELECT @MESSAGE
          CASE @IDCREATE
                CENTERWINDOW w1

          CASE @IDCLOSEWINDOW
                UnSubclassRichEdit(w1,1)
                CLOSEWINDOW w1

          CASE @IDCONTROL
                SELECT @CONTROLID
                endselect

    ENDSELECT
RETURN 0
ENDSUB

SUB RichEditHandler(hwnd:int,uMsg:int,wParam:int,lParam:pointer),int
    SELECT uMsg
          case EM_HIDESEL
                print "EM_HIDESEL Notify"
          case EM_HIDESELECTION
                print "EM_HIDESELELECTION Notify"

    ENDSELECT

RETURN CallWindowProcA(GetPropA(hwnd,"edit_handler"),hwnd,uMsg,wParam,lParam)
ENDSUB

And here is the Ebasic test code:

Code Select

DECLARE IMPORT,SendMessageA(hWnd:uint, message:uint, wParam:int, lparam:uint),uint
DECLARE IMPORT,CallWindowProcA(lpPrevWndFunc:INT,hWnd:INT,Msg:INT,wParam:INT,lParam:INT),INT
DECLARE IMPORT,SetWindowLongA(hWnd:INT,nIndex:INT,dwNewLong:INT),INT
DECLARE IMPORT,SetPropA(hWnd:UINT,lpString:STRING,hData:UINT),INT
DECLARE IMPORT,GetPropA(hWnd:UINT,lpString:STRING),UINT
DECLARE IMPORT,RemovePropA(hWnd:UINT,lpString:STRING),UINT

openconsole

WINDOW w1
OPENWINDOW w1,0,0,500,400,@MINBOX|@MAXBOX|@SIZE|@CAPTION,0,"Window",&handler


CONTROL w1,@RICHEDIT,"",0,0,500,400,0x50B010C4,1
'CONTROL w1,@RICHEDIT,"",0,0,500,400,WS_BORDER|WS_CHILD|WS_VISIBLE|WS_VSCROLL|ES_LEFT|ES_MULTILINE|ES_AUTOVSCROLL,1
' Tried both styles.

  SETFONT w1,"Arial",12,500,0,1
  setcontroltext(w1,1,"Hello" + CHR$(13) + CHR$ (10))
  int rHandle
  rHandle = getcontrolhandle(w1,1)

  setcaption w1,"RC Handle is " + str$(rHandle)

'================ - Here - =========================
const EM_HIDESEL = 0x13 ' 19 decimal
const EM_HIDESELECTION = 0x43F ' 1087 decimal - (already defined in richedit.inc)

SubclassRichEdit(w1,1)
' Tried with sub classing the RE control as well as normal - sels not hidden.

'CONST EM_SETSEL = 0
'SendMessageA(rHandle,EM_SETSEL,0,5)
CONTROLCMD w1,1,@RTSETSELECTION,0,5



' Sets the selection okay.

setfocus w1,1
' Tried different combinations of SETFOCUS,
' e.g. Before selection, after selection, after hide selections - sels not hidden.

'OPTION 1:
'print SendMessageA(rHandle,EM_HIDESEL,1,0)
' Returns 1, leaves the highlight on, does not hide sels.

'OPTION 2:
'print SendMessageA(rHandle,EM_HIDESELECTION,1,0)
' Returns 0, Destroys the highlight, does not hide sels.

' - Have also tried SendMessageW for options 1 & 2 - no difference.

'OPTION 3:
print CONTROLCMD (w1,1,@rthidesel)
' Returns 0, Leaves the highlight on, does not hide sels.

setfocus w1,1
'=============================================

WAITUNTIL w1 = 0
closeconsole
end

SUB SubclassRichEdit(parent as WINDOW,id as INT)
    hEdit = GETCONTROLHANDLE(parent,id)
    lpfn = SetWindowLongA(hEdit,-4,&RichEditHandler)
    SetPropA(hEdit,"edit_handler",lpfn) 
RETURN
ENDSUB
SUB UnSubclassRichEdit(parent as WINDOW,id as INT)
    hEdit = GETCONTROLHANDLE(parent,id)
    SetWindowLongA(hEdit,-4,GetPropA(hEdit,"edit_handler"))
    RemovePropA(hEdit,"edit_handler")
RETURN
ENDSUB

SUB handler(),INT
 SELECT @MESSAGE
          CASE @IDCREATE
                CENTERWINDOW w1

          CASE @IDCLOSEWINDOW
                UnSubclassRichEdit(w1,1)
                CLOSEWINDOW w1

          CASE @IDCONTROL
                SELECT @CONTROLID
                endselect

    ENDSELECT
RETURN 0
ENDSUB

SUB RichEditHandler(hwnd:int,uMsg:int,wParam:int,lParam:pointer),int
    SELECT uMsg
          case EM_HIDESEL
                print "Notify"
    ENDSELECT

RETURN CallWindowProcA(GetPropA(hwnd,"edit_handler"),hwnd,uMsg,wParam,lParam)
ENDSUB
 

Both IWB & EB versions don't work, so what ever Creative Basic is doing, it's not doing it here.

Andy.
7
General Questions / Re: SendMessage not working?
Last post by aurelCB - October 13, 2020, 02:03:29 pm
yes it should work or you can try 
RTHIDESEL      = 19
or 
EM_HIDESEL      = 19
which work in Creative basic

and yes it is 1087
8
General Questions / Re: SendMessage not working?
Last post by Brian - October 13, 2020, 11:06:57 am
Andy,

Just seen a post somewhere where they used the Windows API SendMessage instead of IWB's built-in SendMessage, and it worked

That's 043F Hex, 1087 Dec

Brian
9
General Questions / SendMessage not working?
Last post by Andy - October 13, 2020, 10:03:07 am
Hi,

Here a puzzle, I've gone back to looking at EM_HIDESELECTION.

The rich edit control is not receiving this message - why?

1. The rich edit is sub classed.

2. It receives all other messages.

Take a look:

Code Select
SUB Rich_Edit_Handler(hwnd:int,uMsg:int,wParam:int,lParam:pointer),int

if uMsg = 177 'EM_SETSEL - Works!
print "SET SEL !!!! ",wParam,"  ",lParam
endif

if uMsg = 1087 'EM_HIDESELECTION - Does not Work ?????
  Finish() 'Exit program to check message received...
  print "################## ",wParam,"  ",lParam
endif

After loading a file I tried this:

Code Select
SENDMESSAGE(rHandle,EM_SETSEL,0,10)
print "NOW #########################    ",EM_HIDESELECTION
SENDMESSAGE(w1.Hwnd,EM_HIDESELECTION,1,0)

The EM_HIDESELECTION value of 1087 is correct, but the rich edit control never receives it?

Help please any one...

Thanks,
Andy.
10
Database / Access field types and lengths
Last post by billhsln - October 06, 2020, 05:00:51 pm
We have a way to get the field names from an access table, but I need to know the field type and length.  In other databases there are tables you can use.  Supposedly we could do a select from MsysObjects, but when I try this, Access says I don't have access, even though I am running as Admin.

Thanks,
Bill
Pages1 2 3 ... 10