- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
i coded a nice spin control dialog example here. but i have a problem. i couldnt stop the spin values when they come to max range or min range. you will see it. they exceed the value i assigned...
thank you
i coded a nice spin control dialog example here. but i have a problem. i couldnt stop the spin values when they come to max range or min range. you will see it. they exceed the value i assigned...
thank you
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
i am still trying to slove the problem. but no success:( whenever i put a remark on "set buddy integer" in the style menu of spin controls it works fine. but step is 1. i dont want this. as i remember Jugoslov had told me to add logic to check min/max value. what does that mean? i couldnt teach the spin control to stop when it comes to the min/max value. how can i do that?
thank you...
i am still trying to slove the problem. but no success:( whenever i put a remark on "set buddy integer" in the style menu of spin controls it works fine. but step is 1. i dont want this. as i remember Jugoslov had told me to add logic to check min/max value. what does that mean? i couldnt teach the spin control to stop when it comes to the min/max value. how can i do that?
thank you...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Set buddy integer" style means that "buddy" edit control is set to accept only integers; you don't want that, as Windows "doesn't know" about real numbers.
What I meant is to simply add validation logic before filling in the edit box, i.e. insert:
Since your edit boxes are not read-only, it would be a good idea to add some validation code in case user types in the number. You could add a LOSEFOCUS callback to edit box to verify whether the number is correct and within range:
What I meant is to simply add validation logic before filling in the edit box, i.e. insert:
pos = min(10., max(0., pos)) write(text, "(f6.2)") pos
Since your edit boxes are not read-only, it would be a good idea to add some validation code in case user types in the number. You could add a LOSEFOCUS callback to edit box to verify whether the number is correct and within range:
i = DlgSetSub(Dlg, IDC_EDIT1, OnEdit1, DLG_LOSEFOCUS) ... subroutine OnEdit1(Dlg, id, iEvent) ... real:: pos character(20):: text i = DlgGet(Dlg, id, Text, DLG_STATE) read(Text,*,iostat = iErr) pos if (iErr.ne.0) then !The number is invalid. Do some kind of error handling: i = DlgSet(Dlg, id, "0.") else !Check if it's within range pos = max(pos, 0.) pos = min(pos, 10.) write(text, "(f6.2)") pos status = DlgSet(dlg, IDC_EDIT1, adjustl(text)) end ifJugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page