Help wth APPL_WRITE to send WM_REDRAW message

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
User avatar
TheNameOfTheGame
Atari God
Atari God
Posts: 1429
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Help wth APPL_WRITE to send WM_REDRAW message

Post by TheNameOfTheGame »

Does anyone have a code example to send a WM_REDRAW message via the APPL_WRITE function? I can't seem to find any examples. :?:
User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 856
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by mfro »

User avatar
TheNameOfTheGame
Atari God
Atari God
Posts: 1429
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by TheNameOfTheGame »

Thanks! :cheers:
User avatar
TheNameOfTheGame
Atari God
Atari God
Posts: 1429
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by TheNameOfTheGame »

Ok, I implemented it in the WM_DNLINE case of WM_ARROWED message. But I get a bus error when I run the program and press the down arrow box.

Should I not send a WM_REDRAW message for the down arrow and just jump to the redraw code instead? It doesn't appear like the WM_ARROWED message causes a redraw on it's own.

I'm slowly learning GEM using PureC so I'm not sure I'm approaching this the right way. Any suggestions is appreciated!

One other thing. I put a printf in the case statement and it prints twice for every down arrow press and I'm not sure why. Is there something that should be done to prevent this double click issue?

Code: Select all

		...
				case WM_ARROWED:
					switch ( msg_buf[4] ) {

						case WA_UPPAGE:
					
						break;

						case WA_DNPAGE:

						break;

						case WA_UPLINE:

						break;

						case WA_DNLINE:
							rows_offset += 1;
							printf("DNLINE");
							msg_buf[0] = WM_REDRAW;
							msg_buf[1] = phys_handle;
							msg_buf[2] = 0;
							msg_buf[3] = win_handle;
							msg_buf[4] = wrkx;
							msg_buf[5] = wrky;
							msg_buf[6] = wrkw;
							msg_buf[7] = wrkh;
							appl_write( phys_handle, sizeof(msg_buf), msg_buf );

						break;
						
				....		

*Edit* I think I see one problem. I'm passing the phys_handle instead of the app_id. I think I need APPL_FIND to get the app_id. :?:
User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2711
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by charles »

just a small weary word ,
if you deal with window events and event multi
the system sends out a redraw command automatically to draw your desktop .....

im being vague , but someone here can elaborate....or you will prob encounter by ones self
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!
User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12928
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by wongck »

TheNameOfTheGame wrote: I'm slowly learning GEM using PureC so I'm not sure I'm approaching this the right way. Any suggestions is appreciated!
Think this doc here explains the GEM windowing including scrolling.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list
User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12928
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by wongck »

TheNameOfTheGame wrote: One other thing. I put a printf in the case statement and it prints twice for every down arrow press and I'm not sure why. Is there something that should be done to prevent this double click issue?
Which TOS re you using ?
You may have found the WM_ARROWED bug, where 2 such message are sent.
Read it here (it's German, so Chrome is your friend and search for ARROWFIX).
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list
User avatar
TheNameOfTheGame
Atari God
Atari God
Posts: 1429
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by TheNameOfTheGame »

wongck wrote:
TheNameOfTheGame wrote: One other thing. I put a printf in the case statement and it prints twice for every down arrow press and I'm not sure why. Is there something that should be done to prevent this double click issue?
Which TOS re you using ?
You may have found the WM_ARROWED bug, where 2 such message are sent.
Read it here (it's German, so Chrome is your friend and search for ARROWFIX).
Wow, I am using TOS 2.06. Never knew about that bug so thanks. 8O

I scrapped the idea above and called the redraw code after processing the UPLINE/DNLINE event. So I have the up/down arrows working now other than the 2 messages being sent. :cheers:
Last edited by TheNameOfTheGame on Sun Oct 08, 2017 12:24 am, edited 1 time in total.
User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2711
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by charles »

can u isolate the arrow click and see if it triggers a redraw from the tos?
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!
User avatar
TheNameOfTheGame
Atari God
Atari God
Posts: 1429
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by TheNameOfTheGame »

charles wrote:can u isolate the arrow click and see if it triggers a redraw from the tos?
I did but it doesn't trigger a redraw like some of the other events. I think because depending on where the slider is it may not need a redraw so it is left to the program to decide. At least that's what I'm thinking.
User avatar
TheNameOfTheGame
Atari God
Atari God
Posts: 1429
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by TheNameOfTheGame »

nvm, found arrfix15.zip. :cheers:
User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12928
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by wongck »

charles wrote:can u isolate the arrow click and see if it triggers a redraw from the tos?
WM_ARROWED or any received MSG does not trigger any auto redraw.
You have to do it your yourself, reason being that AES do not know what you want to do when your appl receive that message.
You may need to calculate what is to be drawn, or you may ignore it ( last line or top line for example).
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list
User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12928
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by wongck »

Very nice indeed mfro.
I wanted to implement call back for my window management as I am using one big if then else loop.
And you have an example here.
Why did I not see it when I used your libcmini years ago ??
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list
User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 856
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by mfro »

wongck wrote:
Very nice indeed mfro.
I wanted to implement call back for my window management as I am using one big if then else loop.
And you have an example here.
Why did I not see it when I used your libcmini years ago ??
Thank you.

But honour to whom honour is due: this is just a (rather weak and quickly nailed together) rip-off of the "Geiß-Brother's" object oriented approach from their book "vom Anfänger zum GEM-Profi" that I still consider one of the best books ever written about clean GEM programming on the ST. Unfortunately, it was only available in German, AFAIK.

You can see their approach (and it should be easy to extract a window-handling skeleton) to the full extent in Phoenix (the database application) that recently made it to GitHub: https://github.com/freemint/phoenix
Last edited by mfro on Sun Oct 08, 2017 10:59 am, edited 1 time in total.
User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12928
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Help wth APPL_WRITE to send WM_REDRAW message

Post by wongck »

mfro wrote: You can see their approach (and it should be easy to extract a window-handling skeleton) to the full extent in Phoenix (the database application) that recently made it to GitHub: https://github.com/freemint/phoenix
Thank you for pointing me to the right direction :)
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list
Post Reply

Return to “C / PASCAL etc.”