UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V  1 2 >  (Go to first unread post)
   Reply to this topicStart new topic
> make combo box appear like "regular" toolbar drop-down    
 
   
tpd15
post Dec 15 2005, 09:51 AM
Post#1



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


Hi
I am using an API to hide the dbase window on start-up, adding a pretty slick look to my app (see that thread here). Unfortunately, this also hides the standard &/or custom toolbars! So I need to add something approximating toolbars to my main form.
I am considering using unbound combo boxes, but would like their appearance to be more like that of a toolbar's drop-down, ie: you can't type into them, and perhaps the down arrow is hidden. Can anyone please offer an idea or alternative?
Go to the top of the page
 
cheekybuddha
post Dec 15 2005, 10:12 AM
Post#2


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


Hmm,
sing a combo box would be tricky because whenever it gets the focus the combo comes to the top (ie even if you have covered it with a label so as only to utilise its dropdown feature).
Another approach, but involving a little more coding, might be:
1. Create labels to be your menu headings
2. create a borderless form for the dropdown part of your menu. You could have labels on it to have as the menu items.
3. Use Candace Tripp's wipe effects (see her website) in combination with DoCmd.MoveSize to position and open your menu 'dropdown' form when a menu heading label is clicked or mouse moved, and populate the label captions depending on which heading was clicked.
hth,
d
Go to the top of the page
 
tpd15
post Dec 15 2005, 11:25 AM
Post#3



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


Hi cheekybuddha,
Thanks for the idea. Form what I can picture, it does sound like it's look like a regular drop-down. On the other hand it does seem pretty labour intensive! I will give it a go, but don't quite have the time right at the moment. (I was hoping for a quick & easy answer like "yeah, you can set the property of a combo box to..."! Ah, always the optimist wink.gif).
Go to the top of the page
 
cheekybuddha
post Dec 15 2005, 11:33 AM
Post#4


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


Aye, very labour-intensive, but if you've gone to the trouble of making your app look cool ...
too am ever the optimist and look forward to someone jumping in with the 'simple' solution! wink.gif
d
Go to the top of the page
 
tpd15
post Dec 15 2005, 12:10 PM
Post#5



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


Making it look cool is still one of those 80-20 things for me. If there were more people using this thing then maybe I'd go the extra 20... Basically I'm lazy at heart!
Go to the top of the page
 
cheekybuddha
post Dec 15 2005, 01:30 PM
Post#6


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


Hi Toby,
On alternative solution using your combobox would be to have it with Height = 0
You could then use code to set focus, then dropdown.
Oknew the simple solution would come, but I thought it would be from someone else!
(If you make a combobox with height = 0 and border style = Transparent you can still see a line where it is on your form)
hth,
d
Go to the top of the page
 
tpd15
post Dec 15 2005, 01:34 PM
Post#7



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


Ok, Here's how I cheated it! (Always looking for the easy way out). I used a combination of MouseMoves to selectively hide / reveal the combo. And threw in the API for making the cursor into a little hand. Dbase is attached.

Only thing I couldn't get to work was to have the combo box auto-expand on it's MouseMove. I used the code: Me!Combo7.AutoExpand which errored out. Anyone know how to make that work?

edit>> oops, didn't see your last post. Are we doing similar things?
Edited by: tpd15 on Thu Dec 15 13:35:59 EST 2005.
Attached File(s)
Attached File  UserNameLogonCapture.zip ( 27.82K )Number of downloads: 18
 
Go to the top of the page
 
cheekybuddha
post Dec 15 2005, 02:15 PM
Post#8


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


I played with yur db to try out my suggestion - see what you think.
Attached File(s)
Attached File  1068248-UserNameLogonCapture.zip ( 20.29K )Number of downloads: 38
 
Go to the top of the page
 
tpd15
post Dec 15 2005, 02:56 PM
Post#9



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


That is some beautiful stuff! None of that MouseMove garbage that I had. Although, I did restore the MouseCursor call into the combo's MouseMove, so now it has the little hand when popped open. Glorious!
riginally I had a label for the "Menu" image, but I found I couldn't set focus to it. Eventually I replaced it with a text box, but that was pretty ugly, as you would have noticed.
Questions:
On the 'have my cake and eat it too' front: Is there a way to hide the teeny bit of the down-arrow on the combo box? It kind of looks like a glitch at the moment... I tried selectively setting it to visible but that wasn't too satisfactory.
To call the mousecursor function I used "MouseCursor 32649" while you used "Call MouseCursor(IDC_HAND)"? This whole VBA thing is greek to me, is there a proper way to call a function?
That "With / End With" thing is new to me. Will have to look it up.
When you have 2 controls sitting on top of each other, in design view how do you access the one underneath (so you can change its properties) without having to move the upper one away?
Go to the top of the page
 
cheekybuddha
post Dec 15 2005, 03:46 PM
Post#10


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


Hi Toby,
nswers (I hope!)
1. Cake and eat it...
hmm... this is what I was trying to explain above about seeing a 'line'. The best I could do was to set the focus elsewhere once the combo list was clicked (AfterUpdate) or set the focus elsewhere if the form detail was clicked. If you click on the menu label a couple of times and get the combo to contract then you get that bit of the blue button showing. Setting the combo's border style to solid and border colour to the same as the menu Label's border helps about 75%! Unfortunately, I don't know of a way in code to make a combo contract! I suppose there would be a way to use API's to draw over that portion of the combo button, but that is really a lot more code - not good for lazy people!
2. Using this MouseCursor function from Access Web you only need to call it in the MouseMove event of the menu label. You do not need to turn it "off" as you would if you had used Screen.MousePointer method. Re. the syntax - it doesn't really matter, but for explanation:
Functions return a value, subs don't. To distinguish each in code, normally the arguments of a function are enclosed in brackets and the arguments of a sub aren't. eg.
CODE
    MySub Arg1, Arg2, Arg3
    myvariable = MyFunction(Arg1, Arg2, Arg3)

So, you have a sub with 3 arguments (MySub) which you call simply by writing its name followed by the arguments to pass. Then you have a function with 3 arguments (MyFunction) whose return value we assign to a variable (myvariable)
OK, so far so good - but here's where it gets confusing!
If a sub has only ONE argument you can enclose its argument in brackets!
CODE
    MySub (Arg1)
But you can tell it's a sub because there will be a space (enforced by the VBA editor) between the sub name and its argument.
OK, it gets worse!
Sometimes you want a function to do its stuff but you don't want the return value/result. Above, we had 'myvariable = ...', but if you just put:
CODE
    MyFunction(Arg1, Arg2, Arg3)
the editor would show an error.
You could write it using a sub's syntax and it would be OK:
CODE
    MyFunction Arg1, Arg2, Arg3
But now it looks like a sub - this might be confusing!
So, you can also write:
CODE
    Call MyFunction(Arg1, Arg2, Arg3)
This way it looks like a function and yet we expect no return value.
How addled is your brain now?!!
In the MouseCursor function in your code I used IDC_HAND as the argument. This is a constant declared in the module of the function that has the numeric value required to change the cursor to a hand. You'll see a whole list.
3. With/End With
If you are referencing many of an objects properties it can be useful to use this construct to save you having to type the object over and over. In non-noticeable terms it may be slightly quicker too. What I typed is exactly the same as:
CODE
    Me.Combo7.SetFocus
    Me.Combo7.Dropdown

4. Controls on top of each other.
This one took me ages to work out - and I have a niggling feeling might not have been available in Acc2K. In Acc2K3, the control's property dialog in design view has a combo box at the top listing all the controls in the form. If you don't have it in Acc2K the is the same combo on the 'Formatting Form/Report' toolbar if memory serves.
I hope that helps you out a bit.
d
Go to the top of the page
 
tpd15
post Dec 15 2005, 04:44 PM
Post#11



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


Hiya,
ow! That is some dedication you've got there! Great info, thanks.
1. Yep, I fooled around with it for a bit and couldn't make any prettier, but it's certainly good enough. Will keep it like it is.
2. Yes, my brain is addled! I think I see the difference, but will read it again (and again).
3. With looks pretty handy, will employ at some stage.
4. Nope, Acc2000 doesn't have that. I'll just keep shuffling the controls apart. Tried #Format, #Bring to front / #Send to back, but that didn't help. No matter.
Thanks for all the help!
Go to the top of the page
 
cheekybuddha
post Dec 15 2005, 05:03 PM
Post#12


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


Are you sure there isn't a formatting toolbar that you can display when designing a form? It also has Align Text buttons etc. Have a look in View|Toolbars. It certainly is easier than forever shifting your controls around!
nyway, good luck with the rest,
d
Go to the top of the page
 
tpd15
post Dec 15 2005, 05:11 PM
Post#13



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


Oh, yeah, there totally is! I had to go in and customise the Format toolbar, but it was buried deep in there. Thanks for prodding me!
Go to the top of the page
 
cheekybuddha
post Dec 15 2005, 05:21 PM
Post#14


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


thumbup.gif Glad to help.
Hope it makes life easier.
d
Go to the top of the page
 
tpd15
post Dec 16 2005, 08:17 AM
Post#15



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


One more thing, while I was looking at regular toolbars, I noticed that when you hover over them, they go raised, then when you click them they go sunken.
After a bit of experimentation I managed to get the code to (mostly) work, with
and
where it goes wrong is that the OnClick won't sink the button (it stays raised). I suspect that this is because the mouse is still over it, so that code is still firing. What do you think?
I guess a cheap alternative would be to have the button's backcolour change as you mouse over it (is that how dynamic highlighting is done?).
Go to the top of the page
 
cheekybuddha
post Dec 16 2005, 09:27 AM
Post#16


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


See if this helps a bit.
Attached File(s)
Attached File  1068248-UserNameLogonCapture.zip ( 21.78K )Number of downloads: 23
 
Go to the top of the page
 
cheekybuddha
post Dec 16 2005, 09:29 AM
Post#17


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


I added a module level boolean variable (m_blClicked) to indicate whether the button had been clicked.

Then, in the mouse move event made it so that it would only raise the button if m_blClicked = False.

Oalso added a form Detail mouse move event to clear the button, and a lostfocus event for the combo to clear the button too.

(Ask if you don't understand it)


d
Edited by: cheekybuddha on Fri Dec 16 9:30:49 EST 2005.
Go to the top of the page
 
tpd15
post Dec 16 2005, 10:03 AM
Post#18



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


Wow! Now that's what I call service!
looked it over, and I can kinda see what's going on. Enough that maybe I could cut & paste it elsewhere if I had to. I certainly couldn't have written that myself, so thanks.
On a side note, I have just switched to WinXP Pro from Win 2000, and noticed that buttons hilight to a blue backcolour & white font. For some reason Acc2k doesn't do that... No matter, the look isn't so important as is how to get it running!
Odid a little experimenting of my own since my last post (all the following comments relate to that work). That dbase is attached.
I did do a couple of labels / buttons where they changed looks when hovered over. But then I realised that in the Detail_MouseMove I was going to have to add separate code to revert every frikkin control back to its "normal" look. Does you m_blClicked do that instead? Can it be applied to all controls?
Not knowing much I'd still figure that if I manually set every control to "normal" even when only one of them had been changed, then there's going to be some unnecessary cpu work involved!
Also, when I placed two controls close to each other and moved the mouse real quickly, the Detail_MouseMove didn't fire...
Attached File(s)
Attached File  UserNameLogonCapture.zip ( 27.31K )Number of downloads: 23
 
Go to the top of the page
 
cheekybuddha
post Dec 16 2005, 10:41 AM
Post#19


UtterAccess VIP
Posts: 9,275
Joined: 6-December 03
From: Telegraph Hill


Hi Toby, yes it gets more complicated the more controls you add, and the MouseMove is a bit tricky to work with.
My suggestion would be to create controls that are similarly named like 'lblmenu0', 'lblMenu1', 'lblMenu2' 'cboItems0', 'cboItems1', 'cboItems2' etc and then use loops to change them accordingly.
The repetitive tasks (changing colours, background etc) can be put in a separate sub that takes an index as an argument to reduce the amount of code.
When I get a moment later this afternoon I will try and cook up an example to illustrate what I mean.
d
Go to the top of the page
 
tpd15
post Dec 16 2005, 11:16 AM
Post#20



Posts: 994
Joined: 16-November 04
From: Rochester, NY, USA


Hi,
Mmm, loops & indexes, I cannae do that. But don't invest too much time in it, this isn't mission critical! Thanks for anything you can do, though.
Go to the top of the page
 
2 Pages V  1 2 >


Custom Search
RSSSearch   Top   Lo-Fi    12th December 2017 - 08:14 PM