Modal Windows

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Modal Windows

Postby stevemessamore » Fri Feb 09, 2007 11:44 am

Hi all,

What I'm needing is an application modal window (not just a dialog... the windows are pretty complicated). These windows are non-resizable children of the main application window, and are created on an as-needed basis using the code:

Code: Select all
(FrmPerson abtCreatePart: 'personnelForm' parent: self parentVisual owner: self) openApplicationModalWidget


that is called when an "Edit Person" button is pressed. This displays the window as a child of the main application window, and I really like the behavior of it (doesn't put a new window bar by the start menu, and the child is actually inside the parent - ie. it's clipped by the parent), the only problem is that even though the Edit Person window is always on top, it's still possible to click on the form in the background and have it respond to events.

I've also tried using openFullApplicationModalWidget, openSystemModalWidget, and the parameterized varients, and they all have this problem.

I'm developing under Vista right now, I don't know if this is an issue with any other OS.
Cheers,
Steve
stevemessamore
 
Posts: 7
Joined: Mon Oct 16, 2006 8:49 am
Location: British Columbia, Canada

Postby nmongeau » Fri Feb 09, 2007 1:27 pm

This is somewhat kludgy, but it works: you can set a timer in your window that continuously gives it focus if it loses it. I've done it so in the past:

callbackWin is an instVar of the window.

startTimer
"---------------------------------------------------------------------
To simulate a modal window, we install a timer that
prevents focus loss.
-----------------------------------------------------------------------"

"A windows callback to come back in the image"
callbackWin := EsEntryPoint
receiver: self
selector: #hWnd:uMsg:idEvent:dwTime:
callingConvention: 'c'
arrayBased: false
parameterTypes: #(uint32 uint32 pointer uint32)
returnType: #void.

"Start the timer 10 times per second"
self shell osWidget handle
setTimer: 1
uTimeout: 100
tmprc: callbackWin address



hWnd: widg uMsg: uMsg idEvent: idEvent dwTime: dwTime

| osShell |

"We continuously give focus back to our window"
((osShell := self shell osWidget) isDestroyed not and: [osShell isActiveShell not])
ifTrue: [osShell setFocus].

"A special case to prevent minimizing"
(osShell isDestroyed not and: [osShell isVisible not and: [(self parent notNil and: [self parent osWidget handle isIconic])]])
ifTrue: [self shell abtResurface]
nmongeau
[|]
 
Posts: 29
Joined: Fri Jan 12, 2007 9:37 am

Postby stevemessamore » Mon Feb 12, 2007 2:48 pm

That would work, though 'kludgy' is indeed a good word for the technique ;).

Thanks for your help.
Cheers,
Steve
stevemessamore
 
Posts: 7
Joined: Mon Oct 16, 2006 8:49 am
Location: British Columbia, Canada


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest