[Gambas-user] Simple (I hope) - A list of windows opened by the current app
Bruce Bruen
bbruen at ...2308...
Sat May 21 13:31:16 CEST 2011
On 21/05/11 20:29, Benoît Minisini wrote:
>> On 21/05/11 20:02, Benoît Minisini wrote:
>>
>>>> My main form has a list view which allows the user to open a new form
>>>> for each of the items when they double-click on a row, but if the detail
>>>> form is already open then all I want to do is bring it to the "top".
>>>>
>>>> Achieving this is being fouled by:
>>>> 1) is there a collection/list/whatever of all the windows that belong to
>>>> the Application
>>>>
>>> Windows
>>>
>>> Pretty Obvious 8-) Ya know what I really hate, I was browsing the help
>>> today and I saw this and thought "Hey, that may come in handy someday"
>>> and then prompty forgot all about it. :-X
>>>
>> Moving forward, I'll just use the tag property to track the instance.
>> Is there a better way?
>>
>>
> 'Dunno why you need to "track" the instance.
>
>
>>>> 2) when the user minimizes one of the detail windows, all the
>>>> application windows are minimized
>>>>
>>> It depends on your Gambas version and the window manager you use.
>>>
>> This is a weekend project, (for Little Athletics). I'm trying to lower
>> the benchmark as far as possible so we can use old laptops, so it's
>> Openbox on gambas2 (Still waiting!).
>>
>>
> In Gambas 2, the first opened window is the "main window". Minimizing it
> minimizes all other windows. Closing it closes all other windows. In Gambas 3,
> there is no automatic main window anymore. It is explicit.
>
> Regards,
>
>
Well, I'm using this:
PUBLIC SUB ListView1_DblClick()
DIM f1 AS Form
DIM sTag AS String
DIM sHandel AS Window
sTag = ListView1.Key
sHandel = FindWindow(sTag)
IF NOT IsNull(sHandel)
sHandel.Raise
ELSE
f1 = NEW FTest 'the actual form class of the detail window
f1.Center
f1.Tag = ListView1.Key
f1.Show
ENDIF
END
PRIVATE FUNCTION FindWindow(tag AS String) AS Window
DIM w AS Window
FOR EACH w IN Windows
IF w.Tag = tag THEN RETURN w
NEXT
RETURN NULL
END
This seems to do the trick for (1) and pretty works at light speed. So
all is good.
Re (2) it's not when the user acts on the main window, it's when they
minimise the secondary ("detail") windows. That seems to minimise all
the application windows. I've tried various combinations of SkipTaskBar
and Stacking properties but no luck. I may have to try and intercept
the minimise button click somehow to see whats going on.
bruce
More information about the User
mailing list