programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Re: Tabbed windows

From: <wheath_at_comcast.net>
Date: Sun, 20 May 2007 23:51:52 +0000

Hope this helps Tony,
3 CONSTANT #TABWINS ( NUMBER OF TABBED WINDOWS IN USE )
\ OK SINCE ARRAY VALUES NOT COMPILED
#TABWINS ARRAY HTAB ( ALL TABBED WINDOW HANDLES )
 0 VALUE HSHOW ( LAST DISPLAYED WINDOW HANDLE )

: FOO ( - )
   HWND-TAB -EXIT
   TAB1 DUP TO HTAB1 DUP TO HSHOW 0 HTAB ! \ INIT SHOWN
   TAB2 DUP TO HTAB2 1 HTAB ! \ MATCH TCM_GETCURSEL INDEX
   TAB3 2 HTAB !
   HTAB1 SW_SHOW ShowWindow DROP
   #TABWINS 1
   DO I HTAB @ SW_HIDE ShowWindow DROP
   LOOP ;

\ LESS CRYPTIC
\ LPARAM = POINTER TO NMHDR STRUCTURE OF WM_NOTIFY MESSAGE
: TAB-NOTIFY ( -- res )
   LPARAM
   USING NMHDR CODE @
   TCN_SELCHANGE = \ NEEDS = OTHERWISE RESPONDS TO OTHER NOTIFICATIONS
   IF \ TCN_SELCHANGING OR TCN_KEYDOWN
      LPARAM
      USING NMHDR HWNDFROM @ \ MAIN WINDOW
      TCM_GETCURSEL 0 0 SendMessage ( NSEL ) \ -1=NONE N=NEWLY SELECTED TAB
      0 MAX #TABWINS 1- MIN \ TAB HAS CHANGED NOW DISPLAY CORRECT WINDOW
      HSHOW SWAP HTAB @ ( HHIDE HSHOW )

\ CASE
\ 0 OF HTAB2 HTAB1 ENDOF \ NOTE REVERSED FROM ORIGINAL SAMPLE
\ 1 OF HTAB1 HTAB2 ENDOF
\ HTAB1 HTAB2 ROT \ NEVER GETS HERE
\ \ DUP OF HTAB1 HTAB2 ENDOF \ GOOD THING SINCE HTAB2 \ ORIGINAL
                                      \ WOULD GET DROPPED BY ENDCASE IN ORIGINAL
\ ENDCASE ( HHIDE HSHOW )

      DUP TO HSHOW \ REMEMBER LAST DISPLAYED WINDOW
      SW_SHOW ShowWindow DROP \ DISPLAY CORRECT NEW TABBED WINDOW
      SW_HIDE ShowWindow DROP \ HIDE PREVIOUS WINDOW
   THEN 0 ;
[+SWITCH APP-MESSAGES
   WM_NOTIFY RUNS TAB-NOTIFY
SWITCH]

Warren Heath

-------------- Original message --------------
From: "Tony Senerchia" <asenerchia_at_gmail.com>

> Hi !
> I'm working on a program that will be using tabbed windows based off the
> Tabbed.f in ~\Lib\Samples\Win32
>
> I'm confused with the TAB-NOTIFY section :
>
> : TAB-NOTIFY ( -- res )
> LPARAM 2 CELLS + @ TCN_SELCHANGE IF
> LPARAM @ TCM_GETCURSEL 0 0 SendMessage CASE
> 0 OF HTAB1 HTAB2 ENDOF
> 1 OF HTAB2 HTAB1 ENDOF
> DUP OF HTAB1 HTAB2 ENDOF
> ENDCASE SW_SHOW ShowWindow DROP SW_HIDE ShowWindow DROP
> THEN 0 ;
>
> for different reasons.
>
> First, I need to have 6 or more tabs and I am not sure how to go about doing
> this. I have gotten them to show up (just copies of the second tab with
> changes made to the names given - i.e. " Enter District Name :" becomes "

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Sun May 20 2007 - 16:52:17 PDT

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:42 PST