Brammers Posted May 6, 2008 Posted May 6, 2008 Hi All, basically i was wondering whether there is a way to get FileMaker Pro 9 to actually return the 'Mode' it is in? My client has a Search Button in various places throughout a database, but i'd like to make it so that if the database is in Browse Mode, then the button make FMP enter Find Mode..... but if FMP is already in Find Mode, then the same button actually performs the find. Anyone got any ideas?
Ugo DI LUCA Posted May 6, 2008 Posted May 6, 2008 Hi, If ( Get ( WindowMode ) ) is what you're looking for. [Off Topic] Apart this, in several occasions my clients asked for a reminder so that they could know in what mode they where. Prior to FM9, I was using the state awareness method described by Kevin Frank at http://www.kevinfranck.com Now, conditional formating with a label changing color from the background fill to a red color with the Get ( WindowMode ) calculation is so easy. [/Off Topic]
LaRetta Posted May 6, 2008 Posted May 6, 2008 (edited) Hey Ugo, I know you were just being quick but ... ...If [ ( Get ( WindowMode ) ) ] There are 3 states here not 2 as you know. This would produce true for both find and preview. If error capture wasn't on, you'd get a dang 'No records found' FM error if in Preview mode. Anyway, here's a quick script which would cover all three: If [ Get ( WindowMode ) = 1 ] Perform Find [ ] Else If [ not Get ( WindowMode ) ] Enter Find Mode [ Pause ] End If ... this is assuming you wouldn't want to fire the script while in Preview Mode. But Ugo, yes, I love the new conditional formatting. I usually have header turn yellow in Find. Conditional formatting ROCKS!! UPDATE: Of course add error trap after the Perform Find. LaRetta Edited May 6, 2008 by Guest
Ugo DI LUCA Posted May 6, 2008 Posted May 6, 2008 Hello, Yes of course I was mentionning the function basics. Thanks for explaining it in details. In fact, there are 4 modes btw :
LaRetta Posted May 6, 2008 Posted May 6, 2008 Oh right; I don't think I've ever used 3 since it is buffered! I mentioned preview because I've been caught before when only addressing Browse or Find modes. Thanks, Ugo. :smile2:
Lee Smith Posted May 6, 2008 Posted May 6, 2008 (edited) It is 3 Views, and 4 Modes. LOL Lee Edited May 6, 2008 by Guest
Brammers Posted May 6, 2008 Author Posted May 6, 2008 Thank you all for your replies, they have been most useful, and allowed me to 'get around' the problems I was having... Client's DB is now pretty much complete (thank god, it's quite complicated, and I thought i'd never finish it! Hehe) Also, apologies for posting this message in the wrong forum, I did try to move it, but didn't have a clue how to!
LaRetta Posted May 6, 2008 Posted May 6, 2008 Hi Lee! Yep, I know there are 3 views. But Get ( WindowMode ) = 3 is Printing which is the 4th mode. The modes are 0, 1, 2 and 3. Kinda confusing, I guess. :smile2:
Ugo DI LUCA Posted May 6, 2008 Posted May 6, 2008 (edited) In fact, I can hardly figure out how to get that into a variable or anything... At least, we know it exists... Edited May 6, 2008 by Guest
LaRetta Posted May 6, 2008 Posted May 6, 2008 For the life of me, Ugo, I can't figure out when we would use it. Both platforms simply buffer to the printer anyway and release for another script even if it's a large print job. The release is always instant (sounds like that's what you mean)? Maybe it's to capture that it WAS sent to the printer, like error trap? Ah well. I suppose I don't need to take advantage of EVERY function we have but it sure would be nice for a few examples. :king:
Fitch Posted May 6, 2008 Posted May 6, 2008 The FileMaker online help offers 4 possible results for the Get(WindowMode) function: 0 for Browse mode 1 for Find mode 2 for Preview mode 3 if printing is in progress For some reason they neglect to mention: 4 = Layout mode This is really handy for leaving developer notes on a layout with conditional formatting applied.
Ugo DI LUCA Posted May 6, 2008 Posted May 6, 2008 Tom ? I missed your pig, really ! But could you explain this one, I'd love to make it work, but so far, I can't.
LaRetta Posted May 7, 2008 Posted May 7, 2008 I've haven't used conditional formatting like this and I had forgotten. Somewhere I knew about it though and it works. Create notes to yourself and change color of text to background. Then attach formula (conditional format) of Get ( WindowMode ) = 4 and make the text black. I read about it few months back maybe Matt P?
Fitch Posted May 7, 2008 Posted May 7, 2008 The way to make it work is backwards. I.e., format the text block red in layout mode, and make the conditional [Get(WindowMode) <> 4] to match your layout's background color. Example file attached, just go to Layout mode to see the magic. conditional.zip
fabriceN Posted May 7, 2008 Posted May 7, 2008 (edited) I'm affraid this doesn't mean that Layout mode returns 4. Here, your condition could be 1. It's just a true expression. Edited May 7, 2008 by Guest
comment Posted May 7, 2008 Posted May 7, 2008 I'm affraid this doesn't mean that Layout mode returns 4. If you define an unstored calculation field to return Get ( WindowMode ), put it on a layout and show sample data in Layout mode, you'll see that it does.
Fitch Posted May 7, 2008 Posted May 7, 2008 Or just fire up the Data Viewer and watch Get(WindowMode) while you change modes.
Fitch Posted May 7, 2008 Posted May 7, 2008 It's just a true expression. It's true when you're in Layout mode. If not, it's not.
comment Posted May 7, 2008 Posted May 7, 2008 Ahm, no. The way you have it, Get(WindowMode) <> 4, it's false when you are in Layout mode, and true in ANY other mode.
fabriceN Posted May 7, 2008 Posted May 7, 2008 But conditional formatting is NOT displayed when in layout mode. I really don't follow here (and I would love to)
Lee Smith Posted May 7, 2008 Posted May 7, 2008 (edited) I'm not sure if this is about something else, however, when I look at the file in Layout Mode, there is a conditional formatting text that reads "[color:red]Wow, you’re in layout mode!" Edited May 7, 2008 by Guest
Fitch Posted May 7, 2008 Posted May 7, 2008 Ahm, no. The way you have it, Get(WindowMode) <> 4, it's false when you are in Layout mode, and true in ANY other mode. Yes, sorry. That's what I meant.
Fitch Posted May 7, 2008 Posted May 7, 2008 (edited) But conditional formatting is NOT displayed when in layout mode. Exactly. That's why I said you do it "backwards." The file I posted will make it clear. Oh... wait, I see what you're saying. You could just use the formula "1" -- since when you go to Layout the conditional doesn't apply. No need to use Get(WindowMode) at all. *Slaps forehead* That's actually the way Andy LeCates did it when he demo'd this effect (or something like it) at DevCon last year. Edited May 7, 2008 by Guest Obtuseness.
comment Posted May 7, 2008 Posted May 7, 2008 Exactly. No, not exactly. Conditional formatting IS displayed in Layout mode - if you turn 'Show sample data' on. Otherwise you really wouldn't need the extra mode - as you say, you could simply make the condition always true.
Fitch Posted May 7, 2008 Posted May 7, 2008 Good call, Michael -- that is something I hadn't considered. I'm attaching another file that demonstrates this effect, go to Layout mode and turn sample data on and off to see it. As a bonus to anyone who's stuck with this thread, this file also includes another cool use of conditional formatting that John Sindelar of SeedCode showed us at the Portland FMPUG meeting last month. It's a way of marking a portal row that works even if the rows alternate color. I may not have reproduced it exactly but you'll get the general idea. conditional2.zip
fabriceN Posted May 7, 2008 Posted May 7, 2008 (edited) Nice trick Michael ! but... where do I find the Get ( ViewSampleDataState ) function ? Fitch, this one is a very neat one. Thank you ! I knew transparency would be a BIG thing : EDIT : since everyone has a good story... here is your file modified to illustrate another trick with portal rows. I removed the native alternate background and used conditional formatting (kept the alternance every other 2, but could have done differently) Another advantage is that portals are less flashing this way on record change or redraw. The formatted object (label) contains @@. conditional.fp7.zip Edited May 7, 2008 by Guest
LaRetta Posted May 7, 2008 Posted May 7, 2008 Hi Fabrice, I would guess you and Tom haven't been around forums for awhile ... both of these techniques with portals have been presented several times by Comment, Mr. Vodka, myself, and several others. But we can never have enough of a good thing and everyone can't see every post! There are many more cool tricks with Conditional Format - it certainly is the funnest feature I've ever played with. I never get tired of playing with it!!
comment Posted May 7, 2008 Posted May 7, 2008 (edited) where do I find the Get ( ViewSampleDataState ) function ? It's not a function. It's a setting, found under View > Show > ... EDIT: Oh, you were joking. Sorry, I lost concentration for a minute. Edited May 7, 2008 by Guest
Ugo DI LUCA Posted May 7, 2008 Posted May 7, 2008 Hi Fabrice, I would guess you and Tom haven't been around forums for awhile ... both of these techniques with portals have been presented several times May be you're just considering our loved fmforums as the only place on earth for tip sharing. If not, I can't see how Fabrice could be more active than he already is on forums. He probably is one of the most creative guy I know. The thruth is that he has so many time on his hands. As for Tom, I don't know, I can though recognize his pig from anyother else. Well, except this Layout Mode cool trick, nothing here indeed was new, quite all presented as soon as FM9 was realeased. I mentionned "guy". There's indeed someone else I know, but in that case, calling it time is an euphemism. But what she does sometimes is just crazy, as this file of her that won the French Devcon contest, which in my opinion, is worth a download. Really. Even if I still don't know what I can do with everything that's on that file No web viewer, no plug in, 100% FileMaker work. Optimized for Macintosh though. Agnes Barouh Winner File at French Devcon
fabriceN Posted May 7, 2008 Posted May 7, 2008 Thanks for the compliment, Mister U ! ... even if my latest "creation" is your Godson, which makes it less impartial : I have to admit that with my 194 messages, it's hard to compete with your fabulous 4, all between 2K and 9K messages on this forum (do you type with 60 fingers ;)
LaRetta Posted May 7, 2008 Posted May 7, 2008 Wow, Ugo! Thank you for sharing this with us. I have a wonderful Mac now and I finally got batteries for it even! So I shall do it justice by reviewing it on a Mac! I've reviewed things by Agnes before and she ROCKS! Is the file to download the PekinvDef2 under Annexes? And I know Fabrice is quite busy; we all have many things going and I didn't mean I thought he was sluffing off by going bowling or polishing his car! Ha ha! But we haven't seen either of you for a bit and I just thought you might have missed some of our action (as I'm sure we've missed some of yours). It's wonderful to see you and Fabrice around!! And yeah, Tom provides wonderful assistance here and every time I see his pig, I still laugh. If I ever sound like I'm putting someone down or that I'm being rude, just assume I'm excited and typing faster than my mind. I'm NOT feeling rude at all. If I truly AM being rude, Michael will be the first to let me know (publically even). And yes, there was ONE time I was rude on Forum and ... okay maybe twice. I'm worse when I have nobody to pick on and I'm not working on a rockin' calc. Speaking of which ... where's Genx! I miss that guy!
LaRetta Posted May 7, 2008 Posted May 7, 2008 Hi Fabrice! I stopped to fix dinner and you slid in on me! Nah, not 60 fingers but I type 120 wpm! As said, I type FASTER than my mind runs which is dangerous. Luckily my mouth runs at 50 wpm so I rarely SAY the wrong thing - only type it. :blush2:
Recommended Posts
This topic is 6037 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now